home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 201-220 / scopedisk210 / mcasm / mcasm.doc < prev    next >
Text File  |  1995-03-19  |  126KB  |  4,819 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.     1    The MCAsm Editor
  9.     2    The MCAsm 68000 Macro Assembler
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.     1    The MCAsm Editor                                                 
  69.  
  70.  
  71.  
  72.     
  73.     1.1    Inserting & deleting text
  74.     1.2    Blocks
  75.     1.3    Moving the cursor
  76.     1.4    Search and replace
  77.     1.5    Projects
  78.     1.6    The Environment
  79.     1.7    Memory functions
  80.     1.8    Loading and saving binary data
  81.     1.9    Summary of the MCAsm Editor key sequences
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.     1.1    Inserting & deleting text                                                   
  135.  
  136. The Editor is always in INSERT mode, any ordinary ASCII characters you type
  137. will be inserted at the current cursor position, it has no OVERWRITE mode.
  138. If you wish to replace something you must first delete the unwanted text
  139. and then insert the new, or vice versa. It is not recommended that an
  140. assembler source line is more than 255 characters, however - the Editor
  141. will allow a line length of 999 characters. If you try to insert one more
  142. you will get an error; Line to long.
  143. If you wish to make a new blank line under the current one press Shift Alt Down
  144. or move the cursor to the end of the line and press return.
  145. If you have typed something in the wrong case there are three functions to
  146. help you out:
  147.  
  148.     Amiga ^    Change (flip) case on the word to the right of the cursor
  149.     Amiga &    Make the word to the right of the cursor in lower case
  150.     Amiga *    Make the word to the right of the cursor in upper case
  151.  
  152. If the cursor is positioned on a white space it will first be moved to the
  153. right until an non white space is found and then that word will be changed,
  154. if possible - e.g using Amiga & on a word already in lower case, or a
  155. number, has no effect other than moving the cursor to the end of the word.
  156.  
  157. BACKSPACE and DEL are used to delete one or a few characters and to delete
  158. larger quantities you can use these functions:
  159.  
  160.     Amiga y    Delete all text from the cursor to the end of the line.
  161.     Amiga Y    Delete all text from the left of the cursor to start of line.
  162.     Amiga k    Delete the entire current line. When using this function the
  163.         line deleted is saved in an undo-buffer so it may be
  164.         re-inserted if deleted by mistake.
  165.  
  166. If you delete an entire line by mistake with Amiga k you may restore it
  167. by pressing Amiga l. When doing so the line in the undo-buffer is inserted
  168. at the current line. The line in the undo-buffer may be inserted at any
  169. line and as may times as you wish.
  170.  
  171. There is also another form of restoring a line, Amiga L - undo all changes.
  172. Doing this will restore the current line to the state it was in when you
  173. first entered it. However, Amiga L is only useful as long as you don't
  174. leave the line since this undo-buffer is updated every time you move from
  175. one line to another.
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.     1.2    Blocks                                                           
  201.  
  202. To cut, copy, delete or insert text you use the block commands. You may
  203. also save or print the text currently held in the clip buffer and some
  204. other things. Below is a description of all the block commands.
  205.  
  206.     Amiga b    Mark block. This will turn block on, or off if block is
  207.         already on, you use this command to mark the beginning of a
  208.         block. You may also turn block on/off by clicking on the
  209.         cursor. Once you have marked the beginning of the block you
  210.         move the cursor to the end of the area you wish to operate on
  211.         and select one of the following block functions. When block is
  212.         on most other functions are locked out, for example -  you
  213.         can't type anything if block is on.
  214.  
  215.     Amiga c    Copy block. This will copy the selected area to the clip-
  216.         buffer. The previous contents in the clip-buffer is lost.
  217.         Nothing will happen with the text-file. Using this function
  218.         also turns block off.
  219.  
  220.     Amiga X    Delete block. This will delete the selected area from the
  221.         text-file. The contents in the clip-buffer is not affected.
  222.         Using this function also turns block off.
  223.  
  224.     Amiga x    Cut block. This function will first copy the selected area to
  225.         the clip-buffer and then delete the selected area from the
  226.         text-file. The previous contents in the clip-buffer is lost.
  227.         Using this function also turns block off.
  228.  
  229.     Amiga i    Insert block. This function will insert the contents of the
  230.         clip-buffer into the text-file at the current cursor position.
  231.         The cursor will be positioned at the end of the inserted area.
  232.         The contents of the clip-buffer is not affected so you may
  233.         insert it as many times as you wish. This function can only be
  234.         used if block is off.
  235.  
  236.     Amiga (    Change case block. This function will change (flip) the case
  237.         on all alphabetical characters within the selected area.
  238.         Using this function alsos turn block off.
  239.  
  240.     Amiga )    Make block lower case. This will make all alphabetical
  241.         characters in the selected area lower case.
  242.         Using this function also turns block off.
  243.  
  244.     Amiga _    Make block upper case. This will make all alphabetical
  245.         characters in the selected area upper case.
  246.         Using this function also turns block off.
  247.  
  248.     Amiga C    Clear clip buffer. This function does not affect the selected
  249.         area. It will clear the clip-buffer, freeing all the memory
  250.         it currently occupies.
  251.  
  252.     Amiga Z    Save clip. This function does not affect the selected area or
  253.         the contents of the clip-buffer. It will merely save the
  254.         contents of the clip-buffer to a file, specified by you.
  255.  
  256.     Amiga P    Print clip. This function does not affect the selected area
  257.         or the contents of the clip-buffer. It will only print the
  258.         contents of the clip-buffer.
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.     1.3    Moving the cursor                                                
  267.  
  268. To move the cursor one character in any direction, Up, Down, Left or Right,
  269. you press the appropriate arrow key. Normally this will just move the
  270. cursor on character but if the cursor is at the edge of the screen and
  271. there is more text in the direction you are moving the screen will be
  272. scrolled.
  273.  
  274. If you hold down any of the Alt keys when you press the arrow keys you will
  275. cause the cursor to move 12 characters in the chosen direction:
  276.  
  277.         Alt    Up    move cursor 12 line up
  278.         Alt    Down    move cursor 12 lines down
  279.         Alt    Left    move cursor 12 characters left
  280.         Alt    Right    move cursor 12 characters right
  281.  
  282. You may also move the cursor word by word, to do this hold down the Ctrl
  283. key when you move the cursor:
  284.  
  285.         Ctrl    Left    move cursor one word to the left
  286.         Ctrl    Right    move cursor one word to the right
  287.  
  288. The following functions are used to move fast over large areas:
  289.  
  290.         Ctrl    Up    move cursor to top of file
  291.         Ctrl    Down    move cursor to end of file
  292.         Shift    Up    move cursor to top of screen
  293.         Shift    Down    move cursor to end of screen
  294.         Shift    Left    move cursor to beginning of line
  295.         Shift    Right    move cursor to end of line
  296.  
  297. You may also position the cursor anywhere on the screen, inside the text,
  298. just by clicking on the character with the mouse. If you keep pressing the
  299. left mouse button the cursor will follow the mouse when you move it and
  300. scroll the text vertically if you move the mouse off the top or bottom of
  301. the screen.
  302.  
  303. NOTE,    horizontal scrolling is not possible when moving the cursor with the
  304.     mouse.
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.     1.4    Search and replace                                               
  333.  
  334. To search for a particular piece of text, and maybe replace all occurrences
  335. of that text with something else, or mark a special line in the text so you
  336. can jump to it immediately you use the functions in the Search menu.
  337.  
  338.     Amiga S    Search for. When you use this function the Search for window is
  339.         opened for you so you can define the string to search for, and
  340.         whether or not the editor shall treat upper and lower case as
  341.         the same and if the search is to be made forward or backwards.
  342.  
  343.         If the Editor can't find the specified string it will notify
  344.         you with an error:
  345.  
  346.                     Not found:
  347.                     string
  348.  
  349.  
  350.     Amiga s    Repeat Search Forward. This does just what it says, it will
  351.         start a forward search for the string defined with Search for..
  352.         without opening the Search for window.
  353.  
  354.     Amiga a    Repeat Search Backwards. This will start a backwards search for
  355.         the string defined with Search for.. without opening the
  356.         Search for window.
  357.  
  358.     Amiga R    Replace. This function is very similar to Search for.., the
  359.         Search for window is opened but now you should enter the 
  360.         string that is to replace the search string as well.
  361.         When the Editor finds the search string an inquiry will be
  362.         displayed at the left in the menu bar. To go on from here you
  363.         must press a key and the keys to press are the first in the
  364.         answers.
  365.  
  366.         Yes    Pressing y or Y means that it is ok to replace this
  367.             occurrence of the search string with the replace
  368.             string and then continue the search.
  369.  
  370.         No    Pressing n or N means that this occurrence of the
  371.             search string shall not be replaced with the replace
  372.             string but the search shall continue.
  373.  
  374.         Global    Pressing g or G means that this and all occurrences
  375.             of the search string found after this one shall be 
  376.             replaced with the replace string without asking for 
  377.             permission to do so.
  378.  
  379.         Quit    Pressing q or Q aborts the operation.
  380.  
  381.         Last    Pressing l or L means that it is ok to replace this
  382.             occurrence of the search string with the replace
  383.             string but then the operation is aborted.
  384.  
  385.     Amiga r    Repeat Replace Forward. This functions is the same as Repeat
  386.         Search Forward except that this will go on with the replace
  387.         procedure described above if the search string is found.
  388.  
  389.     Amiga A    Repeat Replace Backwards. This is the same as Repeat Replace
  390.         Forward but backwards instead.
  391.  
  392.     Ctrl Fx    Search for ;Fx. To make it easier for you to move between
  393.         different sections in your text you may insert special marks in
  394.         the text that the Editor can search for automatically, when
  395.         pressing Ctrl Fx (F1-F10).
  396.         These special marks consists of a semicolon (;) an upper case F
  397.         and a digit 0 - 9, for example ;F4. If the Editor is to find
  398.         these marks they must be put at column 1 and they may not
  399.         have any trailing text. Since they start with a semicolon they
  400.         are treated as remarks by the assembler. When searching for a
  401.         ;Fx the Editor always start the search from top of file, so
  402.         only the first occurrence of a mark is used - all sequel marks
  403.         of the same type will never be found. If the Editor can't find
  404.         the mark you are searching for the cursor will be left at the
  405.         position where it was when you started the search.
  406.         These marks have the advantage that they will be saved when you
  407.         save you text - after loading you don't have to mark the lines
  408.         to be able to search for them. The disadvantage is that if it
  409.         is a large file it may take some time for the Editor to scan
  410.         through the text in search for a ;Fx.
  411.  
  412.     Amiga j    Jump to line. This function will open a window for you asking
  413.         for a line to jump to. If the line you specify is outside the
  414.         file it will jump to the top or bottom respectively. If you
  415.         just press return without typing anything the operation is
  416.         aborted.
  417.  
  418.     Amiga J    Jump to Error. If any you get any errors or warnings during
  419.         assembly you can use this function to jump to those lines, in
  420.         the same order as the errors/warnings occurred.
  421.  
  422.         NOTE, if you insert or delete any lines this function will not
  423.               jump to the correct lines.
  424.  
  425.     Amiga !
  426.     Amiga @
  427.     Amiga #
  428.     Amiga $
  429.     Amiga %    Mark a line. Using one of these functions will cause the Editor
  430.         to remember the location of the current line. If you use the
  431.         same function more than once the old line will be forgotten. 
  432.  
  433.     Amiga 1
  434.     Amiga 2
  435.     Amiga 3
  436.     Amiga 4
  437.     Amiga 5    Jump to line. Using one of these will cause the Editor to jump
  438.         to one of the lines it has remembered. These functions operate
  439.         in pairs with the once described above, for example:
  440.  
  441.         use Amiga ! to remember a line, Amiga 1 to jump to it.
  442.  
  443.         Compared with the Search for ;Fx function these functions have
  444.         the advantage that they jump to the marked line instead of
  445.         searching for a mark, which is much faster if the text-file is
  446.         large. However, you must mark the lines before you can jump to
  447.         them.
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.     1.5    Projects
  465.  
  466. This section will describe the functions in the project menu.
  467.  
  468.     Amiga ?    About MCAsm. Using this function simply opens a window
  469.         containing the copyright texts. To make the window go away just
  470.         click in it or press return.
  471.  
  472.     Amiga /    Clear file. This will clear the entire text-file, returning all
  473.         allocated memory used for the text to the system memory pool.
  474.         However, if any changes have been made to the text you must
  475.         confirm that you really want to clear it all away.
  476.  
  477.     Amiga o    Open file. This will load a new text-file. If the file selected
  478.         by you for some reason can't be opened the operation is aborted
  479.         with an error, else the old file will be cleared and the
  480.         selected one loaded, but if an error occurs during the load
  481.         the operation will be aborted with an error and the loaded part
  482.         is cleared away. If any changes have been made to the text you
  483.         must confirm that you want to load a new file without saving
  484.         the changes.
  485.  
  486.     Amiga O    Include file. This is very similar to Insert Block, but now it
  487.         is not the contents of the clip-buffer that is inserted but a
  488.         file. If the file selected for some reason can't be opened or
  489.         loaded the operation is aborted with an error, else the loaded
  490.         file is inserted in the text-file at the current cursor
  491.         position.
  492.  
  493.     Amiga w    Save file. This will save the text-file, immediately - without
  494.         opening the FileRequester, with the same name used to load it.
  495.         (unless the name has been changed with Save File As).
  496.  
  497.     Amiga W    Save file As. This will also save the text-file, but to a file
  498.         selected by you. If the file already exist you must confirm
  499.         that you wish to overwrite it, else the operation is aborted.
  500.  
  501.     Amiga p    Print file. This will print the entire text-file to whatever
  502.         device/file you select. If the selected device/file for some
  503.         reason can't be opened the operation will be aborted with an
  504.         error. After selecting the output print device a new window is
  505.         opened for you so you may specify the indent amount and choose
  506.         whether or not you want the tabs (ASCII 9) to be converted to a
  507.         number of spaces, specified by the tab-distance. If an error
  508.         occurs during printing the operation is aborted with an
  509.         error.
  510.  
  511.     Amiga D    Delete file. This function will delete the selected file.
  512.         However, you must confirm that you really want to delete it. If
  513.         the file for some reason can't be deleted an error is reported.
  514.  
  515.     Amiga d    Current directory. This function lets you specify the current
  516.         directory used by MCAsm. If the selected directory can't be
  517.         found an error will be reported and the old current directory
  518.         will remain.
  519.  
  520.         NOTE, you must choose a directory, not a file. 
  521.  
  522.     Amiga '    Show registers. This function will open the window that
  523.         shows the return values of the registers. This window is
  524.         automatically opened every time you have executed a program in
  525.         memory. However, should you later wish to see the registers
  526.         again, just use this function. To exit click on the close
  527.         gadget or press return.
  528.  
  529.  
  530.     Amiga <    Show symbol table. This function allows you to scan through the
  531.         symbol table. It is very useful if you wish to check if a
  532.         certain symbol exists or what value it has. To move through the
  533.         symbol list you use the slider gadget at the right side, or
  534.         the cursor keys.
  535.         You may also press any alpha-numerical character, causing the
  536.         symbol listing to jump to the first symbol starting with the
  537.         character you pressed. To exit this function click on the close
  538.         gadget or press return.
  539.  
  540.     Amiga >    Show macro table. This function is similar to Show Symbol Table
  541.         but lists the contents of the macro table instead.
  542.  
  543.     Amiga q    Save and quit. This function will first save the text-file,
  544.         immediately, without opening the FileRequester, with the same
  545.         name used to load it (unless it has been changed with Save File
  546.         As), and then killing the MCAsm task, returning all memory
  547.         allocated by MCAsm to the system memory pool, closing all
  548.         windows, screens and other things used.
  549.  
  550.     Amiga Q    Quit. This function will kill the MCAsm task, return all memory
  551.         allocated to the system memory pool and close down all
  552.         resources used. If any changes have been made to the text you
  553.         must confirm that you really want to quit without saving.
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.     1.6    The Environment
  597.  
  598. All the environmental settings for the Editor and the user-definable
  599. assembler defaults are located in the Environment menu.
  600.  
  601.     Shift F2
  602.     Shift F3
  603.     Shift F4
  604.     Shift F5
  605.     Shift F6
  606.     Shift F7
  607.     Shift F8
  608.     Shift F9
  609.     Shift F10    Tab Distance. Using one of these functions will set the
  610.             tab-distance to the selected value.
  611.  
  612.     Amiga t    Customize Tab Distance. When selecting this function a window
  613.         is opened containing a ruler and the current tab settings. To
  614.         toggle the tab-mark on a certain column click on it with the
  615.         mouse. When you're happy press any key to exit.
  616.  
  617.     Amiga H    Load Environment Specify. Using this function opens the
  618.         FileRequester for you to select an environment file to load.
  619.         The FileRequester is always initialized with the default
  620.         environment file S:MCAsmDefaults. Don't load a file that is not
  621.         a MCAsm environment file. If the selected file doesn't exist
  622.         the operation is aborted with an error.
  623.  
  624.     Amiga e    Load Environment Default. This will load the default
  625.         environment file S:MCAsmDefaults immediately without opening
  626.         the FileRequester.
  627.  
  628.     Amiga 6    Specify Symbol Table. You use this function to specify how many
  629.         symbols the symbol-table may hold and the size of the symbol
  630.         storage area. In the Max gadget you specify the maximum number
  631.         of labels allowed in the table, this number must be an even 2^n
  632.         but if you enter something that isn't it is automatically
  633.         adjusted. In the Size gadget you specify the byte-size of the
  634.         symbol storage area - that's where the actual symbol names are
  635.         stored. When you redefine the symbol-table all the symbols hold
  636.         in it are lost. If you ask for a big table or storage and it
  637.         can't be allocated - first an error is reported and then MCAsm
  638.         tries to re-allocated the old area. If that fails to another
  639.         error is reported and then it will allocate 256 bytes. In
  640.         either case you probably have to redefine the table again.
  641.  
  642.     Amiga 7    Specify Macro Table. This function operates in an identical way
  643.         to the one above, but on the macro-table instead.
  644.  
  645.     Amiga 8    Default Section Size. With this function you specify the
  646.         default byte-size of the area to allocate for each section
  647.         during assembly, if not specified with the SECTION directive,
  648.         see section 2.10.8 Section Control.
  649.  
  650.         Screen Height. In the sub-menu to this item you may define the
  651.         height of the screen. When changing the screen MCAsm will first
  652.         try to open the new screen and then close down to old one. If
  653.         the new screen can't be opened an error is reported and the
  654.         operation aborted.
  655.  
  656.     Amiga ,    Source-listing File. This function will open the FileRequester
  657.         to allow you to select the file to which the source-listing, if
  658.         selected, shall be sent during assembly.
  659.  
  660.  
  661.  
  662.     Amiga .    Error-listing File. This function will open the FileRequester
  663.         to allow you to select the file to which the errors and
  664.         warnings, if any, are sent during assembly.
  665.         NOTE, fatal errors are always sent to the screen.
  666.  
  667.     Amiga ;    Symbol-listing File. This function will open the FileRequester
  668.         to allow you to select the file to which the symbol-listing, if
  669.         selected, shall be sent after assembly.
  670.  
  671.     Amiga :    Default Include Dir. This function will open the FileRequester
  672.         to allow you to select the default include directory, which is
  673.         normally I: but you may change it to whatever you like.
  674.         NOTE, you must select a directory, not a file.
  675.  
  676.         Default Source List Ctrl. All the settings in the sub-menu to
  677.         this item are the default source-list settings for the FORMAT
  678.         directive, see 2.10.6 Listing control, 2.4 Listing outputs and
  679.         2.4.1 Source listing for a further discussion of the format and
  680.         control of the source-listing.
  681.  
  682.         Default Symbol List Ctrl. The settings in the sub-menu to this
  683.         item are the default symbol-list settings for the FORMAT
  684.         directive, see 2.10.6 Listing control, 2.4 Listing outputs and
  685.         2.4.3 Symbol listing for a further discussion of the format and
  686.         control of the symbol-listing.
  687.  
  688.         Default Assembler Options. In the sub-menu to this item you
  689.         set the defaults for most of the assembler options, see section
  690.         2.10.1 Assembly control - OPT directive for a complete
  691.         description of all the assembler options.
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.     1.7    Memory functions                                                      
  729.  
  730.     Amiga h    Allocator. This function is used to allocate and free memory
  731.         from and to the system memory pool. In the allocator window
  732.         there are two lists, the Free Mem List to the left and the
  733.         Alloc Mem List    to the right. The Alloc and Free gadgets and
  734.         the five string gadgets - Alloc Addr, Alloc Size, Pre Addr, Pre
  735.         Size and Free Addr. All numbers, addresses and sizes, in the
  736.         Allocator are in hexadecimal notation.
  737.  
  738.     Free Mem List    This list simply shows the current system memory
  739.             free list as is and it is updated every time you
  740.             call on the Allocator. To scan through the list
  741.             use the slider gadget. When you find a suitable
  742.             area that you wish to allocate just click on it
  743.             and it will be copied down to the Alloc Addr &
  744.             Alloc Size gadgets, then click on the Alloc
  745.             gadget and the area is allocated and also shown
  746.             in the Alloc Mem List.
  747.             NOTE,since the list is only updated when the
  748.             Allocator is call upon, you may end up in the
  749.             situation where you can't allocate a memory
  750.             block shown in the Free Mem List, due to it has
  751.             been allocated by the system or some other task
  752.             after opening the Allocator.
  753.  
  754.     Alloc Mem List    This list shows all the areas allocated by
  755.             MCAsm. It is only updated when you allocate a
  756.             new area or free an already allocated one.
  757.             If you wish to free an area click on
  758.             it and the address is copied down to the Free
  759.             Addr gadget, then click on the Free gadget and
  760.             the area is returned to the system memory pool
  761.             and no longer shown in the Alloc Mem List but in
  762.             the Free Mem List.
  763.  
  764.     Alloc         Click on this gadget to allocate the area
  765.             specified in the Alloc Addr & Alloc Size
  766.             gadgets. If the area can't be allocated an error
  767.             is reported. If the cursor is in the Alloc Size
  768.             gadget you may press return instead of clicking
  769.             on this gadget.
  770.  
  771.     Free        Click on this gadget to free the area starting
  772.             at the address given in the Free Addr gadget.
  773.             You don't have to specify the size of the area
  774.             to free, the Allocator will do that for you. If
  775.             the cursor is in the Free Addr gadget you may
  776.             press return instead of clicking on this gadget.
  777.             NOTE, you can only free areas allocated by MCAsm
  778.  
  779.     Alloc Addr    In this gadget you specify the attributes of the
  780.             area to allocate. If you wish to allocate an
  781.             absolute area you give an address, if you want
  782.             public memory you leave it clear, if you want
  783.             chip memory you type 'chip', in lower case, and if
  784.             you want fast you type 'fast', in lower case.
  785.  
  786.     Alloc Size    In this gadget you specify the byte size of the
  787.             area you wish to allocate. When you press
  788.             return, or click on the Alloc gadget the
  789.             allocated will try to allocated the area
  790.             specified in this and the Alloc Addr gadgets. If
  791.             successful it will be shown in the Alloc Mem List,
  792.             else an error is reported.
  793.  
  794.     Free Addr    In this gadget you specify the address of the
  795.             area to free. The address must be to one of the
  796.             areas shown in the Alloc Mem List or an error is
  797.             reported when you try to free it, by pressing
  798.             return or clicking on the Free gadget.
  799.  
  800.     Pre Addr    In this gadget you specify the attributes of the
  801.             pre-allocated area. If you wish to allocate an
  802.             absolute area you give an address, if you want
  803.             public memory you leave it clear, if you want
  804.             chip memory you type 'chip', in lower case, and if
  805.             you want fast you type 'fast', in lower case.
  806.  
  807.     Pre Size    In this gadget you specify the byte size of the
  808.             pre-allocated area. If you alter this definition
  809.             and you want to use it you must save the
  810.             environment so this new definition is saved in
  811.             the environment file S:MCAsmDefaults. When you
  812.             load MCAsm the first thing it does, after having
  813.             loaded the environment file, is to try to
  814.             allocate the area specified in the Pre Addr &
  815.             Pre Size gadgets. If successful it will be shown
  816.             in the Alloc Mem List, else an error is given.
  817.  
  818.     Amiga 9    Editor. This function allows you to look at and edit the
  819.         contents of the entire memory area, (where there is any memory,
  820.         e.g NO hardware register) it does not check if the memory
  821.         you a tampering with is allocated by MCAsm or not. When you
  822.         select this function first a window is opened asking for the
  823.         address of the area to edit. If you enter a NULL string or
  824.         click the close gadget the operation is aborted, else another
  825.         window is opened displaying 11 lines with 16 bytes of data. The
  826.         cursor is positioned at the address you gave. Use the cursor
  827.         keys to move the cursor around. When the cursor is in the area
  828.         of the window showing hexadecimal data you may alter the
  829.         contents of a locating, a nibble at time, by pressing a
  830.         hexadecimal character (0-9 a-f and A-F). When the cursor is in
  831.         the area of the window showing ASCII data you may alter the
  832.         contents of a location, a byte at time, by pressing any normal
  833.         ASCII character (" "-~) plus TAB and ENTER. This function
  834.         may be very useful when looking at structures, list, etc - but
  835.         it can also take you on a short-cut to a system crash if you're
  836.         not careful when altering things in memory, especially if you
  837.         didn't allocate it. However, as long as you are just looking
  838.         nothing can happen. If you wish to look at a new address press
  839.         the DEL key to bring up the address window. To close down the
  840.         memory-editor click on the close gadget or press return.
  841.  
  842.     Amiga 0    Dis-Assembler. When using the dis-assembler, first a window
  843.         will be opened asking for the address of the area to dis-
  844.         assemble. If you enter a NULL string or click on the close
  845.         gadget the dis-assembly is aborted, else a another window is
  846.         opened showing 20 lines of dis-assembled code starting at the
  847.         address you gave. To move one instruction forward in the code
  848.         press the Down cursor key and to move one word backwards in the
  849.         code press the Up cursor key. When you don't want to dis-
  850.         assemble any more click on the close gadget or press the return
  851.         key. If you wish to start a dis-assembly at another address
  852.         press the DEL key to bring up the address window.
  853.  
  854.         NOTE, With this dis-assembler you can't do anything except just
  855.         dis-assemble. However, the intention with the dis-assembler is
  856.         not to provide you with a full featured symbolic debugger but 
  857.         simply to fill the basic need, that sometimes occur, of being
  858.         able to dis-assembler a few lines of code.
  859.  
  860.     1.8    Loading & saving binary data
  861.  
  862.     Amiga {    Load Data. This function will open the FileRequester so you can
  863.         select a file to load, binary into memory. After having
  864.         selected a file you will be asked to specify the start and end
  865.         address of the buffer into which the file is to be loaded. If
  866.         you don't specify any end address you have no limit and the
  867.         entire file will be loaded, regardless of how large it is. No
  868.         checks are made to ensure that the file is loaded into memory 
  869.         allocated by MCAsm, so this function should be used with great 
  870.         care. If you use a symbol not defined in an address or an     
  871.         illegal operator or an expression that MCAsm can't handle - 
  872.         then the operation is aborted with an error.
  873.  
  874.     Amiga }    Save Data. This function works the same way as Load Data except
  875.         that this one saves data instead. Also - you must specify the
  876.         end address when using this function.
  877.  
  878.     Amiga [    Exec BLoad. This will execute the BLOAD list build up during
  879.         assembly with the BLOAD directive, loading all the files
  880.         selected into the specified buffers. If a file can't be opened
  881.         or loaded an error will be reported and then the next file in
  882.         the list will be loaded.
  883.  
  884.     Amiga ]    Exec BSave. This will execute the BSAVE list build up during
  885.         assembly with the BSAVE directive, saving all the specified
  886.         areas to the selected files. If, for some reason, a file can't
  887.         be saved an error is reported and then the next entry in the
  888.         list is processed.
  889.  
  890.  
  891.         NOTE, the BLOAD & BSAVE directives are fully described later in
  892.               chapter 2, section 2.10.10 Binary include.
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.     1.9    Summary of the MCAsm Editor key sequences                        
  927.  
  928. This is a summary of all key sequences in menu order.
  929.  
  930.  
  931.         -- PROJECT MENU --
  932.  
  933.     Amiga ?            Some info about MCAsm
  934.     Amiga /            Clear file
  935.     Amiga o            Open file
  936.     Amiga O            Include file
  937.     Amiga w            Save file
  938.     Amiga W            Save file as
  939.     Amiga p            Print file
  940.     Amiga D            Delete file
  941.     Amiga d            Select current directory
  942.     Amiga C            Clear clip-buffer
  943.     Amiga Z            Save block as
  944.     Amiga P            Print block
  945.     Amiga '            Show register
  946.     Amiga <            Show symbol table
  947.     Amiga >            Show macro table
  948.     Amiga q            Save file and quit
  949.     Amiga Q            Quit
  950.  
  951.  
  952.         -- ENVIRONMENT MENU --
  953.  
  954.     Shift F2        Set tab-distance to 2
  955.     Shift F3        Set tab-distance to 3
  956.     Shift F4        Set tab-distance to 4
  957.     Shift F5        Set tab-distance to 5
  958.     Shift F6        Set tab-distance to 6
  959.     Shift F7        Set tab-distance to 7
  960.     Shift F8        Set tab-distance to 8
  961.     Shift F9        Set tab-distance to 9
  962.     Shift F10        Set tab-distance to 10
  963.     Amiga t            Customize tab-distance
  964.     Amiga e            Load default environment
  965.     Amiga H            Load specific environment
  966.     Amiga E            Save environment
  967.     Amiga 6            Specify symbol table
  968.     Amiga 7            Specify macro table
  969.     Amiga 8            Specify default section code size
  970.     Amiga ,            Define source-listing filename
  971.     Amiga .            Define error-listing filename
  972.     Amiga ;            Define symbol-listing filename
  973.     Amiga :            Specify default include directory
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.         -- ASSEMBLE MENU --
  993.  
  994.     F1            Assemble, no options
  995.     F2            Assemble, symbol-list on
  996.     F3            Assemble, source-list on
  997.     F4            Assemble, source- and symbol-list on
  998.     F5            Assemble, warnings on
  999.     F6            Assemble, warnings & symbol-list on
  1000.     F7            Assemble, warnings & source-list on
  1001.     F8            Assemble, warnings, source- and symbol-list on
  1002.     F9            Assemble, execute if assembly successful
  1003.     F10            Assemble, warnings on, execute if assembly successful
  1004.     Amiga G            Execute program in memory
  1005.     Alt     F1        Select File as assembler output
  1006.     Alt     F2        Select Memory as assembler output
  1007.     Alt     F3        Select None as assembler output
  1008.     Alt     F6        Set code-type to Absolute
  1009.     Alt     F7        Set code-type to Executable
  1010.     Alt     F8        Set code-type to Linkable
  1011.  
  1012.  
  1013.         -- BLOCK MENU --
  1014.  
  1015.     Amiga b            Mark block
  1016.     Amiga c            Copy block to clip
  1017.     Amiga x            Cut block
  1018.     Amiga i            Insert block
  1019.     Amiga X            Delete block
  1020.     Amiga C            Clear clip-buffer
  1021.     Amiga Z            Save block as
  1022.     Amiga P            Print block
  1023.     Amiga k            Delete line
  1024.     Amiga l            Un-Delete line
  1025.     Amiga L            Restore line
  1026.     Amiga y            Delete to end of line
  1027.     Amiga Y            Delete to beginning of line
  1028.     Amiga ^            Change case on word
  1029.     Amiga &            Make word upper case
  1030.     Amiga *            Make word lower case
  1031.     Amiga (            Change case on block
  1032.     Amiga )            Make block upper case
  1033.     Amiga _            Make block lower case
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.         -- SEARCH MENU --
  1059.  
  1060.     Amiga S            Search for..
  1061.     Ctrl  F1        Jump to ;F1 mark
  1062.     Ctrl  F2        Jump to ;F2 mark
  1063.     Ctrl  F3        Jump to ;F3 mark
  1064.     Ctrl  F4        Jump to ;F4 mark
  1065.     Ctrl  F5        Jump to ;F5 mark
  1066.     Ctrl  F6        Jump to ;F6 mark
  1067.     Ctrl  F7        Jump to ;F7 mark
  1068.     Ctrl  F8        Jump to ;F8 mark
  1069.     Ctrl  F9        Jump to ;F9 mark
  1070.     Ctrl  F10        Jump to ;F0 mark
  1071.     Amiga s            Repeat search forward
  1072.     Amiga a            Repeat search backwards
  1073.     Amiga R            Replace..
  1074.     Amiga r            Repeat replace forward
  1075.     Amiga A            Repeat replace backwards
  1076.     Amiga j            Jump to line
  1077.     Amiga J            Jump to error-line
  1078.     Amiga 1            Mark line #1
  1079.     Amiga 2            Mark line #2
  1080.     Amiga 3            Mark line #3
  1081.     Amiga 4            Mark line #4
  1082.     Amiga 5            Mark line #5
  1083.     Amiga !            Jump to line #1
  1084.     Amiga @            Jump to line #2
  1085.     Amiga #            Jump to line #3
  1086.     Amiga $            Jump to line #4
  1087.     Amiga %            Jump to line #5
  1088.  
  1089.  
  1090.         -- MEMORY MENU --
  1091.  
  1092.     Amiga h            Memory allocator
  1093.     Amiga 9            Memory editor
  1094.     Amiga 0            Dis-assembler
  1095.  
  1096.  
  1097.         -- DATA MENU --
  1098.  
  1099.     Amiga {            Load binary data to memory
  1100.     Amiga }            Save binary data from memory to disk
  1101.     Amiga [            Execute the BLOAD list
  1102.     Amiga ]            Execute the BSAVE list
  1103.  
  1104.  
  1105.         -- MOVE MENU --
  1106.  
  1107.     Alt   Up        Move cursor 12 lines up
  1108.     Alt   Down        Move cursor 12 lines down
  1109.     Alt   Left        Move cursor 12 characters left
  1110.     Alt   Right        Move cursor 12 characters right
  1111.     Ctrl  Up        Move cursor to top of file
  1112.     Ctrl  Down        Move cursor to end of file
  1113.     Ctrl  Left        Move cursor one word left
  1114.     Ctrl  Right        Move cursor one word right
  1115.     Shift Up        Move cursor to end of screen
  1116.     Shift Down        Move cursor to end of screen
  1117.     Shift Left        Move cursor to beginning of line
  1118.     Shift Right        Move cursor to end of line
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.         -- OTHER KEY-SEQUENCES --
  1125.  
  1126.     Shift Ctrl Up        Move the entire screen one line up
  1127.     Shift Ctrl Down        Move the entire screen one line down
  1128.     Shift Ctrl Left        Move the entire screen two pixels left
  1129.     Shift Ctrl Right    Move the entire screen two pixels right
  1130.  
  1131.     Shift Alt  Down        Insert a blank line under this one
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.     2    The MCAsm 68000 Macro Assembler
  1191.  
  1192.  
  1193.  
  1194.  
  1195.     2.1    Introduction                        
  1196.     2.2    Invoking the Assembler                
  1197.     2.3    Output code-type and destination        
  1198.     2.4    Listing outputs                    
  1199.     2.4.1    Source listing                        
  1200.     2.4.2    Error listing                        
  1201.     2.4.3    Symbol listing                        
  1202.     2.5    Source code line format                
  1203.     2.5.1    Label field                        
  1204.     2.5.2    Local labels                        
  1205.     2.5.3    Operation field                    
  1206.     2.5.4    Operand field                        
  1207.     2.5.5    Comments                            
  1208.     2.6    Expressions                        
  1209.     2.6.1    Operators                            
  1210.     2.6.2    Expression types                    
  1211.     2.6.3    Numbers                            
  1212.     2.6.4    Absolute long and absolute short        
  1213.     2.7    Addressing modes
  1214.     2.8    Instruction set
  1215.     2.8.1    Instruction coding
  1216.     2.8.2    Data movement instructions
  1217.     2.8.3    Arithmetic instructions
  1218.     2.8.4    Logical instructions
  1219.     2.8.5    Bit operation instructions
  1220.     2.8.6    Shift and rotate instructions
  1221.     2.8.7    Branch instructions
  1222.     2.8.8    Odd instructions
  1223.     2.8.9    Copper instructions
  1224.     2.9    Lattice users
  1225.     2.10    Assembler directives
  1226.     2.10.1    Assembly control
  1227.     2.10.2    Symbol definition
  1228.     2.10.3    Data definition
  1229.     2.10.4    Repeat loops
  1230.     2.10.5    Macros
  1231.     2.10.6    Listing control
  1232.     2.10.7    Conditional assembly
  1233.     2.10.8    Section control
  1234.     2.10.9    Linkable directives
  1235.     2.10.10    Binary include
  1236.     2.10.11    Absolute directives
  1237.     2.10.12    Output directive
  1238.     2.11    Errors and warnings
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.     2.1    Introduction
  1257.  
  1258. MCAsm is a fast and powerful assembler, available instantly from within the
  1259. editor and it assembles the source code, text that is, into AmigaDOS files
  1260. or directly into memory, for immediate execution from the editor.
  1261. This chapter will tell you how to use the MCAsm 68000 Macro Assembler, e.g
  1262. how to invoke it, what inputs it takes and what outputs it produces, how it
  1263. handles numeric expressions, the addressing modes, how to code the
  1264. instructions, what directives it uses and how to code them, etc.
  1265.  
  1266. In this chapter,
  1267.  
  1268.     < >     angled brackets denotes a named item, such as
  1269.             <filename>    <label>    <expression>
  1270.  
  1271.     [ ]    square brackets indicate an optional piece, such as
  1272.             [<label>]        [<size>]
  1273.         
  1274.      -    is used to denote a range of choices, such as
  1275.             0 - 9    A - F    a - z
  1276.  
  1277.      |    is used to denote 'this or that', such as
  1278.             An|Dn    .B|.S|.W 
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.     2.2    Invoking the Assembler
  1323.  
  1324. The Assembler is invoked by selecting one of the ten subitems from the
  1325. Assemble item in the Assemble menu, or by pressing F1 - F10.
  1326. The choices available are:
  1327.  
  1328.         Warnings Listing Symbols Execute
  1329.  
  1330.         OFF      OFF     OFF     OFF    F1
  1331.         OFF      OFF     ON      OFF    F2
  1332.         OFF      ON      OFF     OFF    F3
  1333.         OFF      ON      ON      OFF    F4
  1334.         ON       OFF     OFF     OFF    F5
  1335.         ON       OFF     ON      OFF    F6
  1336.         ON       ON      OFF     OFF    F7
  1337.         ON       ON      ON      OFF    F8
  1338.         OFF      OFF     OFF     ON     F9
  1339.         ON       OFF     OFF     ON     F10
  1340.  
  1341. With this form of invoking you can easily specify if you want the assembler to
  1342. write out the warnings, if any, produce a source-listing and/or a
  1343. symbol-listing and, if you wish, automatically execute the code, if assembled
  1344. to memory and no errors are found - all at the touch of a button.
  1345. All other assembler options/defaults are taken from the defaults specified
  1346. in the Assemble and Environment menus. (Unless the defaults are overridden
  1347. by certain directives in the source.)
  1348. If any errors are found in the first pass the assembler will abort at the
  1349. beginning of the second pass. At the end of assembly you will be asked to
  1350. press any key, or click the left mouse button, to return to the editor.
  1351. To abort the assembler, simply press CTRL C. To pause the assembler when it
  1352. is writing to the screen, listings, warnings or errors, simply press SPACE
  1353. and to resume press BACKSPACE
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.     2.3    Output code-type and destination
  1389.  
  1390. MCAsm is capable of producing three kinds of code, Absolute, Executable and
  1391. Linkable and send it to either an AmigaDOS file, memory or nothing.
  1392. The default is to create executable code and send it to nothing.
  1393. Now a description of the different destinations, which are accessible in
  1394. the Output to item in the Assemble menu or by pressing the key sequence
  1395. shown after the destinations.
  1396.  
  1397.     File        Alt F1
  1398.  
  1399. This will output the code to whatever device selected. If an error has
  1400. occurred during assembly no output will be written. If producing executable
  1401. code the output file is an AmigaDOS load file, if producing linkable code
  1402. it is an AmigaDOS object file and if producing absolute code the output is
  1403. a standard AmigaDOS file, with a special structure in the beginning.
  1404.  
  1405.     location    type        meaning
  1406.     0        long        code origin address
  1407.     4        long        code length
  1408.     8        long        execute address
  1409.  
  1410. For every ORG directive there will be one structure like this.
  1411. If you are sending your code to a none storage device e.g SER: the
  1412. <outname> has no meaning, else <outname> is calculated as follows.
  1413.  
  1414. If a <filename> is given when selecting File as output then
  1415.     <outname> = <filename>
  1416. else
  1417.     if OUTPUT has not been used then
  1418.         <outname> = <source filename> without an extension or .o
  1419.     else
  1420.         if OUTPUT specifies an <extension> then
  1421.             <outname> = <source filename> + OUTPUT <extension>
  1422.         else
  1423.             <outname> = OUTPUT <filename>
  1424.  
  1425. NOTE,    the assembler will not give a warning if the output file already    
  1426.     exists but simply overwrite it.
  1427. NOTE,    the OUTPUT directive is described later in 2.10.12 Output directive.
  1428.  
  1429.     Memory        Alt F2
  1430.  
  1431. Programs assembled to memory can be executed be pressing Amiga G or by
  1432. selecting Execute in the Assemble menu. Programs executed from the editor
  1433. shall end with a RTS to return control to MCAsm. If you are writing task
  1434. manipulating code it is MCAsm's task you are manipulating. Before executing
  1435. a program MCAsm saves all system vectors, hardware registers dmaconr,
  1436. intenar, adkconr and the initial copper pc, initializes system vectors 2,
  1437. 3, 4, 5, 6, 7, 9, 10 and 11 with the address to MCAsm's own guru-catcher.
  1438. If a return is made to MCAsm through one of the vectors the hardware
  1439. registers and vectors saved earlier are restored and then the CPU registers
  1440. will be displayed with a line telling you what error caused the return. If
  1441. the return was made by a RTS the PC and SR values will be invalid. If you
  1442. must know the PC or SR value on return you can, temporarily, end you
  1443. program with the ILLEGAL directive, but if you run that from AmigaDOS the
  1444. system will crash. If producing executable code the assembler will allocate
  1445. the necessary memory, if producing absolute code you must allocate memory
  1446. yourself with the Allocator or ALLOC directive. Even if you can send
  1447. linkable code to memory it is not the best thing to do since all external
  1448. references are still unresolved.
  1449.  
  1450.     None        Alt F3
  1451.  
  1452. The assembler will not produce any output at all. Useful for test-assembly.
  1453.  
  1454. The different code-types are accessible in the Type of code item in the
  1455. Assemble menu or by pressing the key sequence shown after the types.
  1456.  
  1457.     Absolute    Alt F6
  1458.  
  1459. Absolute code is normally only used in games since these programs normally
  1460. not use the Amiga in a normal way but tend to take over the entire machine
  1461. and therefore can keep an absolute memory map. If you're using absolute
  1462. code it is a smart thing to turn off type-checking so you can perform much
  1463. more complex operations with the relative symbols since these are no longer
  1464. relative, but absolute.
  1465.  
  1466.     Executable    Alt F7
  1467.  
  1468. If you are writing entirely in assembly language and the program is not to
  1469. large then executable is the normal choice. It does not need any linking,
  1470. it can be assembled directly to memory and executed to reduce development
  1471. time.
  1472.  
  1473.     Linkable        Alt F8
  1474.  
  1475. If you are interfacing with a high-level language you have no choice but to
  1476. use linkable code. Also, if you are writing a program as a team or the code
  1477. is rather large, say 100k code, then linkable is the best suited form.
  1478.  
  1479.  
  1480.  
  1481.     2.4    Listing outputs
  1482.  
  1483. There are three different types of listings produced by the assembler:
  1484. Source, Error and Symbol listing.
  1485. Each line of listing can be up to 511 characters long, the default is 132,
  1486. and the minimum is 38. The line length is controlled with the LLEN
  1487. directive.
  1488. The Source and Symbol listing output is paginated by default, it can be
  1489. disabled with the NOPAGE directive and re-enabled with PAGEON, and the page
  1490. length is either specified by the user with the PLEN directive,
  1491. or 60 - the default.
  1492. The format of each printed pages is:
  1493.  
  1494. <heading>    MCAsm 68000 Macro Assembler Version 1.0          Page : nn
  1495. <title>        the <string> given with the TTL directive or if not given 
  1496.         the name of the source-file.    
  1497. <subtitle>    the <string> given with the SUBTTL directive or if not
  1498.         given just an ASCII LF, e.g a blank line.
  1499. ASCII LF    a blank line.
  1500. <listing>    PLEN lines of either the source or symbol listing.
  1501. ASCII FF    a formfeed character.
  1502.  
  1503. Each listing may be sent to it's own file or all to the same. The filenames
  1504. for the different listings are specified in the Environment menu.
  1505. However, fatal errors are always written to the screen.
  1506.  
  1507. NOTE,    if source-listing and/or symbol-listing are not selected when
  1508.     starting the assembly the source-list and/or symbol-list file(s) are
  1509.     not opened, so if you enable them later they will be sent to the
  1510.     screen, regardless of what file specified.
  1511.  
  1512. NOTE,    the TTL, SUBTTL and PLEN directives are described later in section  
  1513.      2.10.6 Listing control.
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.     2.4.1    Source listing
  1521.  
  1522. A fully featured line of source listing have the following format:
  1523.  
  1524.     Columns    Contents            Format
  1525.  
  1526.     1-5    Line number        5-digit decimal
  1527.     6    Blank
  1528.     7-8    Section number        2-digit hexadecimal
  1529.     9    Dot (.)
  1530.     10-17    PC in hexadecimal    8-digit hexadecimal
  1531.     18    Blank
  1532.     19-29    PC in decimal        10-digit decimal
  1533.     30    Blank or '+'        '+' if macro-list else blank
  1534.     31-50    Generated code        20-digit hexadecimal
  1535.     51    Blank
  1536.     52-59    Flags            T S I X N Z V C
  1537.     60    Blank
  1538.     61-74    Execution time        T-states(reads/writes)
  1539.     75    Blank
  1540.     76-END    Source line        <label><operation><operand><comment>
  1541.  
  1542. Every field except the source line itself can be either enabled or
  1543. disabled. The form shown above have all fields enabled. In the simplest
  1544. form, with all fields disabled, the source listing output only consists of
  1545. the source line.
  1546.  
  1547.     Columns    Contents            Format
  1548.  
  1549.     1-END    Source line        <label><operation><operand><comment>
  1550.  
  1551. The line number start at 1 for the first line in the main source file and
  1552. is incremented by 1 for every line assembled in the main file. The line
  1553. number is not normally increased in include-files and macros, but if you
  1554. wish to do so you can do it either by setting the default line number
  1555. increment method in the Default Program List Ctrl in the Environment menu,
  1556. or by using the FORMAT directive, see section 2.10.6 Listing control.
  1557. The section number simply shows the number of the current section if it is
  1558. a CODE, DATA or BSS section. If it is an offset section the section number
  1559. will show 'O  ', if it is a REPEAT loop it will show 'R  ' and if the
  1560. directive on the line is defining a symbol the section number will show 
  1561. '  ='.
  1562. For instructions and non-symbol defining directives the PC field contain
  1563. the current program counter value. For directives containing expressions
  1564. whose value are of interest (EQU, SET, REG etc) the value of the expression
  1565. is printed in the PC field.
  1566. The Generated code field contain up to 5 words of data generated by an
  1567. instruction or a data defining directive. If a directive generates more
  1568. than 5 words of data these will not be seen. If a directive doesn't
  1569. generate any code this field is left blank.
  1570. The Flags field show what flags are affected by the instruction and this is
  1571. only shown on instructions. The meaning of the characters are as follows:
  1572.  
  1573.     - not affected, * affected, 0 cleared, 1 set, U undefined.
  1574.  
  1575. The Execution time field show the number of T-states, (reads/ and writes)
  1576. required to execute the instruction. However, in some cases it is not
  1577. possible to compute the execution time at assembly, e.g dynamic shifts,
  1578. mul, div etc. In these cases the time is shown either as a maximum value,
  1579. e.g mul, div etc, or as a base time plus n * something, e.g shifts and n is
  1580. the number of bits to shift.
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.     2.4.2    Error listing                                                    
  1587.  
  1588. The error listing has the following format:
  1589.  
  1590.     <source line>    one line of source-listing, e.g the line with the error.
  1591.     <error line>    a line with the error/warning message
  1592.     ASCII LF
  1593.  
  1594.  
  1595. The error/warning messages have the following format:
  1596.  
  1597. *** Error nn: text
  1598. ** Warning nn: text
  1599.  
  1600. where:
  1601.         nn            is the error/warning number.
  1602.         text            is a short text explaining the fault.
  1603.  
  1604.  
  1605.  
  1606.     2.4.3    Symbol listing                                                   
  1607.  
  1608. The symbol table listing is a sorted list of all symbols defined in the
  1609. assembly. A fully featured line of symbol listing have the following
  1610. format:
  1611.  
  1612.     Columns    Contents                    Format
  1613.  
  1614.     1-9    Symbol value in hexadecimal    $ + 8-digit hexadecimal number
  1615.     10    Blank
  1616.     11-21    Symbol value in decimal        10-digit signed decimal number
  1617.     22    Blank
  1618.     23-26    Symbol type            4-character type
  1619.     27    Blank
  1620.     28-END    Symbol name
  1621.  
  1622. All fields except the symbol name can be either enabled or disabled. Above
  1623. all fields are enabled. The simplest form with all fields disabled only
  1624. show the symbol name.
  1625.  
  1626. The type field contain:
  1627.  
  1628.     Type    Meaning
  1629.  
  1630.     A    Absolute symbol, defined with EQU, RS or RC
  1631.     AT    Absolute temporary symbol, defined by SET
  1632.     sn.R    Relative symbol, e.g a label. sn is the section number
  1633.     sn.T    Relative temporary symbol, defined by SET
  1634.     Loc    Local label
  1635.     RL    Register list symbol, defined by REG
  1636.     SPEC    Special MCAsm symbols
  1637.     E    Un-typed external symbol, defined by XREF
  1638.     EA    Absolute external symbol, defined by XREF.A or XREF.L
  1639.     E.R    Relative external symbol, defined by XREF.R
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.     2.5    Source code line format
  1653.  
  1654. This section describes the different forms of an input line. It is not
  1655. recommended that an input line is more than 255 characters long.
  1656. Basically a source line consists of four fields:
  1657.  
  1658.     [<label>]    <operation>    [<operand(s)>]    [<comment>]
  1659.  
  1660.     start    move.l    a7,init_sp    Save initial stack
  1661.  
  1662.     label        Optional, but depends on the operation
  1663.     operation    Optional
  1664.     operand(s)    Optional, but depends on the operation
  1665.     comment        Optional
  1666.  
  1667. A source line can be blank, or entirely be a comment line - starting with
  1668. an asterisk (*) or a semi-colon (;), in either case it is completely
  1669. ignored by the assembler. Each field must be separated by any number of
  1670. tabs or spaces, known as <white space>.
  1671.  
  1672.  
  1673.  
  1674.     2.5.1    Label field
  1675.  
  1676. If a line starts with one of the following combinations it contains a
  1677. label:
  1678.  
  1679. <symbol><white space>
  1680. <symbol>:
  1681. <white space><symbol>:
  1682.  
  1683. Such a sequence is referred to elsewhere as a <label>.
  1684. The normal starting position for a label is column 1, but if it is required
  1685. to start in any other column it must end with a colon (:).
  1686. If a line contains a label and nothing more, then the current values of the
  1687. program and section counters will be assigned to the label and it's type
  1688. will be relative (sn.R), otherwise the value and type to be assigned to the
  1689. label depends on the operation.
  1690. Labels are allowed on all instructions, optional on some directives,
  1691. forbidden on some and necessary on others.
  1692. A label may consist of any mixture of the characters A-Z, a-z, 0-9, the dot
  1693. (.) and the underscore (_).
  1694. For example:
  1695.  
  1696. start, Text_2, main_1.0, _CX22, loop
  1697.  
  1698. You must not use register names as labels.
  1699.  
  1700. There are a few reserved symbols in MCAsm:
  1701.  
  1702. __LK            3 = linkable, 4 = executable, 5 = absolute
  1703. __RS            the current value of the rs_counter
  1704. __RC            the base address for the RC definitions, rc_base
  1705. NARG            the number of arguments supplied to the current macro
  1706. PreAllocatedAddress    start-address of the pre-allocated area
  1707. PreAllocatedSize    size of the pre-allocated area
  1708. PreAllocatedEnd        end-address of the pre-allocated area
  1709. AllocatedAddress_n    start-address of allocated area number n
  1710. AllocatedSize_n        size of allocated area number n
  1711. AllocatedEnd_n        end-address of allocated area number n
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.     2.5.2    Local labels
  1719.  
  1720. A local label can be defined many times in a program and they are normally
  1721. used as loop labels. Local labels are only valid between two non local
  1722. labels.
  1723. For example:
  1724.  
  1725. func1    move.l    #'    ',d1
  1726. .loop    move.l    d1,(a1)+
  1727.     clr.w    (a1)+
  1728.     dbf    d0,.loop
  1729.     rts
  1730. func2    moveq    #0,d0
  1731. .loop    move.l    d0,(a2)+
  1732.     dbf    d1,.loop
  1733.     rts
  1734.  
  1735. Normally a local label begin with a dot (.) but if you wish to introduce a
  1736. local label with an underscore (_) you can do so with OPT U+ and change
  1737. back to the dot (.) with OPT U-. Also, a label made up of decimal
  1738. characters and ending with a dollar-sing ($) is also accepted as a local
  1739. label. For example:
  1740.  
  1741. func2    moveq    #0,d0
  1742. 4$    move.l    d0,(a2)+
  1743.     dbf    d1,4$
  1744.     rts
  1745.  
  1746. The local labels .L and .W should not be used to avoid confusion with the
  1747. size specifiers absolute long and absolute short.
  1748.  
  1749.  
  1750.  
  1751.     2.5.3    Operation field
  1752.  
  1753. The Operation field follows the label field and the syntax is:
  1754.  
  1755. <white space><operation>
  1756.  
  1757. The operation is either an 68000 instruction, a macro, an assembler
  1758. directive or blank.
  1759. MCAsm is case-insensitive to operations, so MOVE is the save as move and
  1760. MoVe and Dc is the save as dc and DC.
  1761.  
  1762.  
  1763.  
  1764.     2.5.4    Operand field
  1765.  
  1766. The syntax of the operand field depends on the operation and therefore the
  1767. operand field syntax is described for every instruction and directive.
  1768. MCAsm is case-insensitive to operands, unless it contains a symbol and
  1769. OPT C+ is used.
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.     2.5.5    Comment field
  1785.  
  1786. All text after the first not quoted <white space> after the operand field
  1787. and all text after a non quoted semicolon (;), or asterisk (*) if it is the
  1788. first character on the line, is taken as a comment. This text is ignored by
  1789. the assembler.
  1790.  
  1791. Some examples of source lines:
  1792.  
  1793. ; Hi, this is a comment line
  1794.  
  1795. * so is this
  1796.  
  1797. start    ; a lonely label
  1798.  
  1799.     move.l    a7,init_sp    save stack
  1800.  
  1801.     test:    dc.b    'an indented label, note spaces allowed in quotes' comment
  1802.  
  1803. start:lea    stack,a7
  1804.  
  1805. GRAPHICS    =    $20000
  1806.  
  1807. COPPER=$10000;The start address of the copper list
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.     2.6    Expressions
  1851.  
  1852. MCAsm allows complex expressions and supports full operator precedence. All
  1853. expressions are made up of any number of symbols, numbers, operators and
  1854. parentheses, and they are of two types - absolute and relative.
  1855. Absolute expressions are constants, known at assembly time while Relative
  1856. expressions are, as the name implies, relative and not known at assembly
  1857. time, unless you are producing absolute code when all relative symbols
  1858. actually are absolute, since the AmigaDOS loader can put the code anywhere
  1859. it likes in memory when loading it.
  1860. Some instructions and directives place restrictions on what types of
  1861. expressions they can handle and some operators do not work with certain
  1862. symbol combinations.
  1863.  
  1864.  
  1865.  
  1866.     2.6.1    Operators
  1867.  
  1868. The available operators are listed below in decreasing order of precedence.
  1869.  
  1870. 1. Unary operators    Unary plus (+), Unary minus (-), Logical not (~)
  1871. 2. Shift operators    Left shift (<<), Right Shift (>>)
  1872. 3. Binary operators    Binary and (&), Binary or (!or|), Binary xor (^)
  1873. 4. Multiply, Divide    Multiply (*), Divide (/)
  1874. 5. Add, Sub        Addition (+), Subtraction (-)
  1875. 6. Comparison        Equality (=), Less than (<), Greater than (>)
  1876.  
  1877. To override the precedence of the operators, you must enclose sub-
  1878. expressions in parentheses, ellipses () or square brackets []. Operators of
  1879. equal precedence are evaluated from left to right. Spaces and tabs are not
  1880. allowed in expressions, unless within quotes, since they are regarded as
  1881. delimiters between fields.
  1882.  
  1883. The comparison operators are signed and return -1 ($ffffffff) if true or 0
  1884. if false.
  1885.  
  1886. All expressions are evaluated using 32-bit signed integer arithmetic and no
  1887. checks are made for overflow.
  1888.  
  1889.  
  1890.  
  1891.     2.6.2    Expression types
  1892.  
  1893.          -----------------------------------------------
  1894.         |           |             Operands              |
  1895.         | Operators |-----------------------------------|
  1896.         |           | A op A | A op R | R op A | R op R |
  1897.         |-----------|--------|--------|--------|--------|
  1898.         | Shift     |   A    |   *    |   *    |   *    |
  1899.         |-----------|--------|--------|--------|--------|
  1900.         | Binary    |   A    |   *    |   *    |   *    |
  1901.         |-----------|--------|--------|--------|--------|
  1902.         | Mul & Div |   A    |   *    |   *    |   *    |
  1903.         |-----------|--------|--------|--------|--------|
  1904.         | Add       |   A    |   R    |   R    |   *    |
  1905.         |-----------|--------|--------|--------|--------|
  1906.         | Sub       |   A    |   *    |   R    |   A    |
  1907.         |-----------|--------|--------|--------|--------|
  1908.         | Compare   |   A    |   *    |   *    |   A    |
  1909.          -----------------------------------------------
  1910.  
  1911.         Figure 2.6.2 - Allowed types of expression combinations
  1912.  
  1913.  
  1914.  
  1915.  
  1916. The table in Figure 2.6.2 shows the result produced by each operator for
  1917. the different types of combination of parameters and which combinations are
  1918. not allowed. A denotes absolute, R denotes relative and * denotes an error,
  1919. e.g the operation is not allowed.
  1920. NOTE, the unary operators are only allowed on absolute symbols.
  1921.  
  1922.  
  1923.  
  1924.     2.6.3    Numbers
  1925.  
  1926. Numbers may be used as a term of an expression or as a single value. All
  1927. numbers are absolute quantities.
  1928. The following formats are allowed for absolute numbers:
  1929.  
  1930.     Decimal
  1931.     (a string of decimal characters 0 - 9)
  1932.     Example:    463
  1933.  
  1934.     Hexadecimal
  1935.     ($ followed by a string of hexadecimal characters 0- 9, A - F, a - f)
  1936.     Example:    $4afc
  1937.  
  1938.     Octal
  1939.     (@ followed by a string of octal characters 0 - 7)
  1940.     Example:    @7345
  1941.  
  1942.     Binary
  1943.     (% followed by a string of binary characters 0 and 1)
  1944.     Example:    %101010100
  1945.  
  1946.     ASCII
  1947.     (Up to 4 ASCII characters within single or double quotes)
  1948.     Example:    'hi'
  1949.  
  1950. The quote used to begin an ASCII number must also end it, e.g "hi' is
  1951. illegal. To include a quote in the number, either enclose it with the other
  1952. quote or type it twice. If less than 4 characters are used the number is
  1953. justified to the right, padding it with zeros.
  1954. Here are some more examples of ASCII numbers:
  1955.  
  1956.     What        'What'
  1957.     it's        'it''s'
  1958.     it's        "it's"
  1959.     
  1960. The use of an asterisk (*) denotes the current value of the program counter
  1961. and this is always a relative quantity.
  1962.  
  1963.  
  1964.  
  1965.     2.6.4    Absolute long and absolute short
  1966.  
  1967. The normal way of specifying absolute short addressing is to end the
  1968. expression with .w
  1969.  
  1970.         movea.l    AbsExecBase.w,a6
  1971.  
  1972. However, this will give an error as the dot is supposed to be a part of the
  1973. symbol. To get around this, expressions that are to be absolute short or
  1974. forced to absolute long may be enclosed within parentheses ending with .w
  1975. or .l, unless it is a single number where the normal way works just fine.
  1976.  
  1977.         movea.l    (AbsExecBase).w,a6
  1978.  
  1979.  
  1980.  
  1981.  
  1982.     2.7    Addressing modes
  1983.  
  1984. The following table shows the addressing modes available. Dn represent one
  1985. of the data registers D0 - D7, An represent one of the address registers
  1986. A0 - A7, In represents an index register An or Dn with an optional size .W
  1987. or .L and if not given .W is assumed. d represents a number.
  1988.  
  1989. Mode        Meaning                    Example
  1990.  
  1991. Dn      Data register direct                move.w d0,d1
  1992. An      Address register direct            move.l a1,a0
  1993. (An)      Address register indirect            clr.l  (a0)
  1994. (An)+      Address register indirect post increment    tst.w  (a0)+
  1995. -(An)      Address register indirect pre decrement    tst.w  -(a0)
  1996. d(An)      Address register indirect with displacement    tst.w  10(a0)
  1997. d(An,In)  Address register indirect with index        tst.w  10(a0,d1.l)
  1998. d.W      Absolute short addressing            move.l 4.w,a6
  1999. d.L      Absolute long addressing            clr.l  $1000[.l]
  2000. d(pc)      Program counter relative with offset        move.b flag(pc),d0
  2001. d(pc,In)  Program counter relative with index        jsr    tb(pc,d1.w)
  2002. #d      Immediate data                moveq  #0,d0
  2003.  
  2004. In the table above SP may be specified instead of address register A7.
  2005. For example:
  2006.  
  2007.     move.l    a6,-(sp)
  2008.  
  2009. When using Address register indirect with index the displacement must not
  2010. be specified. For example:
  2011.  
  2012.     jsr    (pc,d0.w)
  2013.  
  2014. will be assembled as
  2015.  
  2016.     jsr    0(pc,d0.w)
  2017.  
  2018. There are also four special addressing modes only available with certain
  2019. instructions and these addressing modes are:
  2020.  
  2021.     USP    user stack pointer
  2022.     SR    status register
  2023.     CCR    condition code register (lower byte of SR)
  2024.  
  2025. For example:
  2026.  
  2027.     and.w    d0,sr
  2028.     move    a0,usp
  2029.     ori.b    #$10,ccr
  2030.  
  2031.     and
  2032.  
  2033.     Reg-list    register lists
  2034.  
  2035. For example:
  2036.  
  2037. func    movem.l    d1-d7/a0-a6,-(a7)
  2038.     ..
  2039.     ..
  2040.     ..
  2041.     movem.l    (a7)+,d1-d7/a0-a6
  2042.     rts
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.     2.8    Instruction set
  2049.  
  2050. Some instructions have an address variant (destination is an address
  2051. register), immediate (source is immediate data), quick (source is immediate
  2052. data in the range 0 < data < 9) and a memory variant (both operands are
  2053. address register indirect post increment).
  2054. If you wish to force a certain variant you may append A, Q, L or M to the
  2055. instruction.
  2056.  
  2057. NOTE,    the correct forms are always assembled faster than if the assembler
  2058.     must make the conversion.
  2059.  
  2060. In this case the assembler will use the specified variant, if it exists or
  2061. give an error. If you don't specify a particular variant the assembler will
  2062. automatically convert to the A, I or M variant where necessary, but not to
  2063. the Q variant.
  2064. For example:
  2065.  
  2066.     add.l    d0,a0
  2067.  
  2068. will be assembled as
  2069.  
  2070.     adda.l    d0,a0
  2071.  
  2072. The following is a table of the instructions that have variants and which:
  2073.  
  2074.     ---------------------------------------
  2075.    | Instr |   A   |   I   |   Q   |   M   |
  2076.    |-------|-------|-------|-------|-------|
  2077.    | move  | movea |   -   | moveq |   -   |
  2078.    |-------|-------|-------|-------|-------|
  2079.    | cmp   | cmpa  | cmpi  |   -   | cmpm  |
  2080.    |-------|-------|-------|-------|-------|
  2081.    | add   | adda  | addi  | addq  |   -   |
  2082.    |-------|-------|-------|-------|-------|
  2083.    | sub   | suba  | subi  | subq  |   -   |
  2084.    |-------|-------|-------|-------|-------|
  2085.    | and   |   -   | andi  |   -   |   -   |
  2086.    |-------|-------|-------|-------|-------|
  2087.    | or       |   -   | ori   |   -   |   -   |
  2088.    |-------|-------|-------|-------|-------|
  2089.    | eor   |   -   | eori  |   -   |   -   |
  2090.     ---------------------------------------
  2091.  
  2092. There are two extensions to the normal condition codes; HS and LO,
  2093. equivalent to CC and CS. These extensions are supported by all instructions
  2094. using condition codes.
  2095.  
  2096. All instructions and directives, except DC.B, DCB.B, DS.B, RC.B and RCB.B
  2097. are always assembled on a word boundary. If any of the directives above are
  2098. to be on an even address you may use the EVEN directive before it.
  2099.  
  2100. NOTE,    even if instructions are always word aligned labels without a
  2101.     directive are not. For example:
  2102.  
  2103.         dc.b    0
  2104. label
  2105.         bra.s    label
  2106.  
  2107. Here label will be assigned to an odd value and the generated code will not
  2108. work. To help you find such errors you may use OPT E+ which will tell the
  2109. assembler to check if the addresses used are even, or give an error if not.
  2110.  
  2111.  
  2112.  
  2113.  
  2114.     2.8.1    Instruction coding
  2115.  
  2116. This section will list all the instructions, and tell you how to code them.
  2117. For a detailed description of all 68000 instructions you should consult a
  2118. manual for the Motorola MC68000 processor.
  2119. Instructions that can operate on different sizes end with a size specifier,
  2120. referred to as <size> later in this section, and the allowed sizes are .L,
  2121. .W, .B and .S. If no size is given the default size, normally .W, is used.
  2122. If an instruction can only operate with one size it may optionally be
  2123. defined anyway (in this case the one size allowed is also the default one).
  2124. <ea> denotes a general effective address, However - what specific
  2125. addressing modes allowed with the instruction in question is not described,
  2126. <ea> simply indicates that those allowed are from the table described in
  2127. section 3.7. Please note that MCAsm is case-insensitive with both
  2128. instructions, sizes and addressing modes (unless the addressing mode chosen
  2129. has a symbol and OPT C+ is in use). 
  2130.  
  2131.  
  2132.  
  2133.     2.8.2    Data movement instructions
  2134.  
  2135. The general form for the MOVE instruction is:
  2136.  
  2137.     MOVE[<size>]    <ea>,<ea>
  2138.  
  2139. Above all sizes are allowed, but if the destination <ea> is An only .L and
  2140. .W are allowed and the assembler will generate the instruction:
  2141.  
  2142.     MOVEA[<size>]    <ea>,An
  2143.  
  2144. The quick form:
  2145.  
  2146.     MOVEQ[.L]    #d,Dn
  2147.  
  2148. and the special forms of the move instruction:
  2149.  
  2150.     MOVE[.L]    An,USP
  2151.     MOVE[.L]    USP,An
  2152.     MOVE[.W|.B|.S]    <ea>,SR
  2153.     MOVE[.W]    SR,<ea>
  2154.     MOVE[.B|.S]    <ea>,CCR
  2155.  
  2156. The move peripheral instruction, sizes allowed are .L and .W:
  2157.  
  2158.     MOVEP[<size>]    Dn,d(An)
  2159.     MOVEP[<size>]    d(An),Dn
  2160.  
  2161. and the last form of the MOVE instruction, MOVEM, allowed sizes, .L and .W:
  2162.  
  2163.     MOVEM[<size>]    Reg-list,<ea>
  2164.     MOVEM[<size>]    <ea>,Reg-list
  2165.  
  2166. Below are the other data movement instructions, swap, exchange, load
  2167. effective address ,push effective address and clear:
  2168.  
  2169.     SWAP[.W]    Dn
  2170.     EXG[.L]        Dn|An,Dn|An
  2171.     LEA[.L]        <ea>,An
  2172.     PEA        <ea>
  2173.     CLR[<size>]    <ea>
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.     2.8.3    Arithmetic instructions
  2181.  
  2182. The general forms of the ADD, SUB and CMP instructions are:
  2183.  
  2184.     ADD[<size>]    <ea>,<ea>
  2185.     SUB[<size>]    <ea>,<ea>
  2186.     CMP[<size>]    <ea>,<ea>
  2187.  
  2188. All sizes are allowed unless the destination is An when only .W and .L are
  2189. allowed and the assembler generates the instructions:
  2190.  
  2191.     ADDA[<size>]    <ea>,An
  2192.     SUBA[<size>]    <ea>,An
  2193.     CMPA[<size>]    <ea>,An
  2194.  
  2195. The quick forms. Note the an An destination is allowed in the quick form if
  2196. the size is .W or .L and that CMP has no quick form:
  2197.  
  2198.     ADDQ[<size>]    #d,<ea>
  2199.     SUBQ[<size>]    #d,<ea>
  2200.  
  2201. The immediate forms:
  2202.  
  2203.     ADDI[<size>]    #d,<ea>
  2204.     SUBI[<size>]    #d,<ea>
  2205.     CMPI[<size>]    #d,<ea>
  2206.  
  2207. and for the CMP instruction, the memory form:
  2208.  
  2209.     CMPM[<size>]    (An)+,(An)+
  2210.  
  2211. The other arithmetic instructions, negate, extend, test, multiply and
  2212. divide. All sizes allowed where nothing else is specified:
  2213.  
  2214.     NEG[<size>]    <ea>
  2215.     EXT[.W|.L]    Dn
  2216.     TST[<size>]    <ea>
  2217.     MULU[.W]    <ea>,Dn
  2218.     MULS[.W]    <ea>,Dn
  2219.     DIVU[.W]    <ea>,Dn
  2220.     DIVS[.W]    <ea>,Dn
  2221.         
  2222. The extended arithmetic instructions, all sizes allowed:
  2223.  
  2224.     ADDX[<size>]    Dn,Dn
  2225.     ADDX[<size>]    -(An),-(An)
  2226.     SUBX[<size>]    Dn,Dn
  2227.     SUBX[<size>]    -(An),-(An)
  2228.     NEGX[<size>]    <ea>
  2229.  
  2230. and the decimal coded arithmetic instructions, allowed sizes are .B and .S:
  2231.  
  2232.     ABCD[<size>]    Dn,Dn
  2233.     ABCD[<size>]    -(An),-(An)
  2234.     SBCD[<size>]    Dn,Dn
  2235.     SBCD[<size>]    -(An),-(An)
  2236.     NBCD[<size>]    <ea>
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.     2.8.4    Logical instructions
  2247.  
  2248. The general forms for the AND, OR and EOR instructions are as follows; all
  2249. sizes are allowed:
  2250.  
  2251.     AND[<size>]    Dn,<ea>
  2252.     AND[<size>]    <ea>,Dn
  2253.     AND[<size>]    #d,<ea>
  2254.  
  2255.     OR[<size>]    Dn,<ea>
  2256.     OR[<size>]    <ea>,Dn
  2257.     OR[<size>]    #d,<ea>
  2258.  
  2259.     EOR[<size>]    Dn,<ea>
  2260.     EOR[<size>]    <ea>,Dn
  2261.     EOR[<size>]    #d,<ea>
  2262.  
  2263. If the source is an immediate value, e.g #d, the assembler will generate
  2264. the immediate forms:
  2265.  
  2266.     ANDI[<size>]    #d,<ea>
  2267.     ORI[<size>]    #d,<ea>
  2268.     EORI[<size>]    #d,<ea>
  2269.  
  2270. The immediate forms also have the following special forms:
  2271.  
  2272.     ANDI[.W|.B|.S]    #d,SR
  2273.     ORI[.W|.B|.S]    #d,SR
  2274.     EORI[.W|.B|.S]    #d,SR
  2275.  
  2276.     ANDI[.B|.S]    #d,CCR
  2277.     ORI[.B|.S]    #d,CCR
  2278.     EORI[.B|.S]    #d,CCR
  2279.  
  2280.  
  2281.  
  2282.     2.8.5    Bit operation instructions
  2283.  
  2284. The available bit operation instructions are listed below.
  2285. Note that if the destination is Dn the size is always .L, and .B | .S if
  2286. the destination is anything else.
  2287. However - you may specify it if you wish but the assembler ignores it.
  2288.  
  2289.     BTST[<size>]    Dn,<ea>
  2290.     BTST[<size>]    #d,<ea>
  2291.  
  2292.     BSET[<size>]    Dn,<ea>
  2293.     BSET[<size>]    #d,<ea>
  2294.  
  2295.     BCLR[<size>]    Dn,<ea>
  2296.     BCLR[<size>]    #d,<ea>
  2297.  
  2298.     BCHG[<size>]    Dn,<ea>
  2299.     BCHG[<size>]    #d,<ea>
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.     2.8.6    Shift and rotate instructions
  2313.  
  2314. These are the shift and rotate instructions available, all sizes allowed if
  2315. nothing else is specified.
  2316.  
  2317.     ASL[<size>]    Dn,Dn
  2318.     ASL[<size>]    #d,Dn
  2319.     ASL[.W]        <ea>
  2320.  
  2321.     ASR[<size>]    Dn,Dn
  2322.     ASR[<size>]    #d,Dn
  2323.     ASR[.W]        <ea>
  2324.  
  2325.     LSL[<size>]    Dn,Dn
  2326.     LSL[<size>]    #d,Dn
  2327.     LSL[.W]        <ea>
  2328.  
  2329.     LSR[<size>]    Dn,Dn
  2330.     LSR[<size>]    #d,Dn
  2331.     LSR[.W]        <ea>
  2332.  
  2333.     ROL[<size>]    Dn,Dn
  2334.     ROL[<size>]    #d,Dn
  2335.     ROL[.W]        <ea>
  2336.  
  2337.     ROR[<size>]    Dn,Dn
  2338.     ROR[<size>]    #d,Dn
  2339.     ROR[.W]        <ea>
  2340.  
  2341.     ROXL[<size>]    Dn,Dn
  2342.     ROXL[<size>]    #d,Dn
  2343.     ROXL[.W]    <ea>
  2344.  
  2345.     ROXR[<size>]    Dn,Dn
  2346.     ROXR[<size>]    #d,Dn
  2347.     ROXR[.W]    <ea>
  2348.  
  2349.  
  2350.  
  2351.     2.8.7    Branch instructions
  2352.  
  2353. The branch instructions, except DBcc, may have the sizes .B or .S for short
  2354. and .W for word branch. If .L is specified .W is used and a warning is
  2355. given since .L is a 68020 and upwards branch size.
  2356. If no size is specified .W is used.
  2357.  
  2358. NOTE,    if you want to optimize branches you should not specify .W but leave
  2359.     them with no size, since the optimizer doesn't optimize branches
  2360.     specificly made .W - no matter how close they are.
  2361.  
  2362.     Bcc[<size>]    <expr>
  2363.     BRA[<size>]    <expr>
  2364.     BSR[<size>]    <expr>
  2365.     DBcc        Dn,<expr>
  2366.  
  2367. The allowed condition codes for Bcc and DBcc are:
  2368.  
  2369.     CC, CS, EQ, NE, GT, LT, GE, LE, HI, LO, HS, LS, MI, PL, VC, VS.
  2370.  
  2371. for DBcc also:
  2372.  
  2373.     F, T, RA.  RA is a synonym for F.
  2374.  
  2375.  
  2376.  
  2377.  
  2378.     2.8.8    Other instructions
  2379.  
  2380. These are the rest of the instruction:
  2381.  
  2382.     CHK[.W]        <ea>,Dn
  2383.  
  2384.     TRAP        #d
  2385.     TRAPV
  2386.  
  2387.     JMP        <ea>
  2388.     JSR        <ea>
  2389.  
  2390.     LINK        #d,An
  2391.     UNLK        An
  2392.  
  2393.     NOP
  2394.  
  2395.     RESET
  2396.  
  2397.     RTE
  2398.     RTR
  2399.     RTS
  2400.  
  2401.     TAS        <ea>
  2402.  
  2403.     STOP        #d
  2404.  
  2405.     Scc        <ea>
  2406.  
  2407. The condition codes allowed for Scc are the same as for DBcc except that RA
  2408. is not supported as a synonym for F.
  2409.  
  2410.  
  2411.  
  2412.     2.8.9    Copper instructions
  2413.  
  2414. This is the copper instruction format accepted by MCAsm.
  2415.  
  2416.     CMOVE    #d,Hardware_register
  2417.  
  2418.     CWAIT    #vert_pos,#vert_mask,#hor_pos,#hor_mask,#wait_blitter_flag
  2419.  
  2420.     CSKIP    #vert_pos,#vert_mask,#hor_pos,#hor_mask,#wait_blitter_flag
  2421.  
  2422. See the Hardware Reference Manual for a description on how the copper and
  2423. the copper instructions work.
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.     2.9    Lattice users
  2445.  
  2446. If you do not write assembler programs that are to be linked together with
  2447. a C module produced by the Lattice C compiler v4.0 or later, you do not
  2448. have to read this section.
  2449.  
  2450. Lattice have two external reference classes allowing
  2451. relocatable locations to be accessed with d(An) or d(An,In).
  2452. Normally all data in a C program are relative to address register A4,
  2453. located in the section __MERGED.
  2454. To allow the C program to access you assembler data and vice versa:
  2455.  
  2456.         XDEF    _Pointer
  2457.         XDEF    _Type,_Flag
  2458.         XREF    _START,_END
  2459.  
  2460.         SECTION    TEXT
  2461.  
  2462.         movea.l    _Pointer(a4),a1
  2463.         move.l    #_Type,(a1)
  2464.         move.w    _Flag(a4),2(a1)
  2465.         movea.l    _START(a4),a2
  2466.         movea.l    _END(a4),a3
  2467.         rts
  2468.  
  2469.         SECTION    __MERGED,DATA
  2470.  
  2471. _Pointer    dc.l    0
  2472. _Type        dc.l    0
  2473. _Flag        dc.w    1
  2474.  
  2475. If you are interfacing with a C program, don't forget the underscores.
  2476. This feature is only usable if you are producing linkable code, but don't
  2477. try to use it with the version of Blink supplied with MCAsm or Alink. It
  2478. only works with the Blink linker supplied with the Lattice C compiler v4.0
  2479. and later.
  2480.  
  2481. NOTE,    the labels used this way must be XDEFed and the base address
  2482.     register properly initialized (this is normally done by the C
  2483.     program).
  2484.  
  2485. For further information on interfacing assembly-language with a C program,
  2486. look in your Lattice C manual.
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.     2.10    Assembler Directives
  2511.  
  2512. The directives are instructions to the assembler, rather than instructions
  2513. that are translated into executable code. Listed below are all the
  2514. directives that the assembler recognizes; after that is an individual
  2515. description for each and every one.
  2516.  
  2517. NOTE,    if nothing is said about the <label> type and value, the type is
  2518.     relative and the value will be set to the current value of the
  2519.     program counter.
  2520.  
  2521. Assembly control    Directive    Description
  2522.             
  2523.             END        End of source
  2524.             INCLUDE        Include a source file
  2525.             INCDIR        Define INCLUDE directories
  2526.             OPT        Option control
  2527.             EVEN        Align to word boundary
  2528.             CNOP        Align to whatever
  2529.             FAIL        Generate an error
  2530.             ILLEGAL        Generate an illegal instruction
  2531.  
  2532.  
  2533. Symbol definition    Directive    Description
  2534.  
  2535.             EQU        Assign permanent value
  2536.             SET        Assign temporary value
  2537.             REG        Assign permanent value, register list
  2538.             RS        Assign permanent absolute value
  2539.             RSSET        Set RS counter
  2540.             RSRESET        Reset RS counter
  2541.  
  2542.  
  2543. Data definition        Directive    Description
  2544.  
  2545.             DC        Define constant
  2546.             DCB        Define constant block
  2547.             DS        Define storage
  2548.             RC        Define constant, absolute label
  2549.             RCB        Define constant block, absolute label 
  2550.             RCSET        Set RC base
  2551.             RCRESET        Reset RC base
  2552.  
  2553.  
  2554. Repeat loops        Directive    Description
  2555.  
  2556.             REPT        General repeat
  2557.             ENDR        General end-repeat
  2558.             FREPT        Fast repeat
  2559.             ENDFR        End fast repeat
  2560.             IREPT        Immediate repeat
  2561.  
  2562.  
  2563. Macros             Directive    Description
  2564.  
  2565.             MACRO        Define a macro
  2566.             ENDM        End a macro definition
  2567.             MEXIT        Conditionally exit a macro
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576. Listing control        Directive    Description
  2577.  
  2578.             PAGE        Start a new page
  2579.             NOPAGE        Turn paging off
  2580.             PAGEON        Turn paging on
  2581.             LIST        Turn listing on
  2582.             NOLIST        Turn listing off
  2583.             TTL        Define title
  2584.             SUBTTL        Define subtitle
  2585.             PLEN        Define page length
  2586.             LLEN        Define line length
  2587.             SPC        Skip n blank lines
  2588.             LISTCHAR    Send control characters
  2589.             FORMAT        Define listing format
  2590.  
  2591.  
  2592. Conditional assembly    Directive    Description
  2593.  
  2594.             IFEQ        Assemble if zero
  2595.             IFNE        Assemble if not zero
  2596.             IFGT        Assemble if greater than
  2597.             IFGE        Assemble if greater or equal
  2598.             IFLT        Assemble if less than
  2599.             IFLE        Assemble if less or equal
  2600.             IFD        Assemble if symbol defined
  2601.             IFND        Assemble if symbol not defined
  2602.             IFC        Assemble if strings are equal
  2603.             IFNC        Assemble if strings are not equal
  2604.             ELSE        Switch assembly state
  2605.             ELSEIF        Switch assembly state
  2606.             ENDC        End conditional
  2607.             ENDIF        End conditional
  2608.             IF        Short form for IFNE
  2609.             IIFEQ        Immediate IFEQ
  2610.             IIFNE        Immediate IFNE
  2611.             IIFGT        Immediate IFGT
  2612.             IIFGE        Immediate IFGE
  2613.             IIFLT        Immediate IFLT
  2614.             IIFLE        Immediate IFLE
  2615.             IIFD        Immediate IFD
  2616.             IIFND        Immediate IFND
  2617.             IIFC        Immediate IFC
  2618.             IIFNC        Immediate IFNC
  2619.             IIF        Immediate IF
  2620.  
  2621.  
  2622. Section control        Directive    Description
  2623.  
  2624.             SECTION        Program section
  2625.             CODE        Program code section
  2626.             DATA        Data section
  2627.             BSS        Bss section
  2628.             OFFSET        Absolute offsets
  2629.  
  2630.  
  2631. Linkable directives    Directive    Description
  2632.  
  2633.             IDNT        Define hunk_unit name
  2634.             XREF        Reference external symbol
  2635.             XDEF        Define external reference
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642. Binary include        Directive    Description
  2643.  
  2644.             INCBIN        Include binary file
  2645.             BLOAD        Load binary into memory
  2646.             BSAVE        Save binary from memory
  2647.  
  2648.  
  2649. Absolute directives    Directive    Description
  2650.  
  2651.             ORG        Set program origin
  2652.             ENT        Set program execution point
  2653.             INITREG        Set register initial value
  2654.             ALLOC        Allocate absolute memory
  2655.  
  2656.  
  2657. Output directive    Directive    Description
  2658.  
  2659.             OUTPUT        Define output filename
  2660.  
  2661.  
  2662.                     
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.     2.10.1    Assembly control
  2709.  
  2710.     END
  2711.  
  2712. Tells the assembler that no more text is to be assembled and everything
  2713. after this directive is ignored.
  2714. END need not be specified, the assembler will find EOF anyway.
  2715.  
  2716.     INCLUDE    <filename>
  2717.  
  2718. This will cause the assembler to take the source code from the file named 
  2719. <filename> (in normal AmigaDOS format). When EOF has been reached, assembly
  2720. will continue at the line after the line with the INCLUDE directive.
  2721. If a space is present in the filename it should be enclosed in single or
  2722. double quotes. If no drive specifier is present e.g DF0:, the assembler
  2723. will first look for the file in the default include directory, specified
  2724. with the Default Include Dir item in the Environment menu, and after that
  2725. in the directories specified with INCDIR. If the file isn't found the
  2726. assembler will give an error. INCLUDE directives may be nested as deeply as
  2727. memory allows.
  2728.  
  2729.     INCDIR    <directory>[,<directory>]...
  2730.  
  2731. This directive adds the directory(s) to the directory list used be INCLUDE
  2732. and INCBIN. If the directory name contains a space it should be enclosed in
  2733. single or double quotes. The directory name may or may not end with a slash
  2734. (/).
  2735.  
  2736. NOTE,    if INCDIR is to have any effect it must be given before the INCLUDE
  2737.     directives.
  2738.  
  2739.     OPT    <option>[,<option>]...
  2740.  
  2741. This allows control over all the options within the assembler. The default
  2742. state for most options may be user specified in the Default Assembler
  2743. Options item in the Environment menu. Those who are not listed in the
  2744. Default Assembler Options are options that affect something else than a
  2745. pure option, such as OPT L - which is used to select executable or linkable
  2746. code and therefore affect the code-type, which is selected in the Type of
  2747. Code item in the Assemble menu. The allowed options are:
  2748.  
  2749. Option A - Automatic PC-relative addressing.
  2750.  
  2751.     lea    base,a6
  2752.  
  2753. will automatically be transformed into
  2754.  
  2755.     lea    base(pc),a6
  2756.  
  2757. during assembly.
  2758.  
  2759. Note that this is always done if the instruction allow it and before it is
  2760. actually assembled, so if the address is out of range you will get an
  2761. error. To override this you can force the assembler to use absolute long
  2762. addressing by doing the following:
  2763.  
  2764.     lea    (base).l,a6
  2765.  
  2766. OPT A+ will turn this option on and OPT A- will turn it off. It may be used
  2767. as many times as you wish.
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774. Option B - Automatic execution of BLOAD/BSAVE lists after assembly.
  2775.  
  2776. B+    will turn on  execution for both BLOAD and BSAVE.
  2777. B-    will turn off execution for both BLOAD and BSAVE.
  2778. BL+    will turn on  execution for BLOAD.
  2779. BL-    will turn off execution for BLOAD.
  2780. BS+    will turn on  execution for BSAVE.
  2781. BS-    will turn off execution for BSAVE.
  2782.  
  2783. NOTE,    only the last given B option is taken into account.
  2784.  
  2785. Option C - Case-sensitivity and number of significant characters.
  2786.  
  2787. Using OPT C+ will make the assembler case-sensitive and OPT C- will make it 
  2788. case-insensitive. The number of significant characters may be specified
  2789. with a decimal number between the C and the sign, e.g OPT C8- denotes      
  2790. case-insensitivity and 8 significant characters.
  2791.  
  2792. NOTE,    this option is active on both symbols and macro-names and it should
  2793.     only be used once at the beginning of the source, before any symbols
  2794.     have been defined.
  2795.  
  2796. Option D - Debugging information.
  2797.  
  2798. AmigaDOS supports the inclusion of a debug_hunk in the binary output file.
  2799. This may be useful if you are debugging your code with a symbolic debugger
  2800. that can read the debug_hunk. Normally all the relative symbols are
  2801. included in the debug_hunk but a special case arise if you use OPT X with
  2802. linkable code, described later. Use OPT D+ to activate and OPT D- to
  2803. deactivate.
  2804.  
  2805. NOTE,    only the last given D option is taken into account.
  2806.  
  2807. Option E - Even addresses.
  2808.  
  2809. When this option is activated the assembler will check the addresses on
  2810. instructions that use a word or longword access and see if they are even,
  2811. if not - an error will be given. Use OPT E+ to activate and OPT E- to
  2812. deactivate. This option may be used as often as you like.
  2813. For example:
  2814.  
  2815.     dc.b    0
  2816. start
  2817.     bra    start
  2818.  
  2819. Since the label has an odd value the assembler will give an error.
  2820.  
  2821. offset    equ    1
  2822.  
  2823.     move.l    offset(a0),d0
  2824.  
  2825. This will also give an error,
  2826.  
  2827.     move.b    offset(a0),d0
  2828.  
  2829. but this is ok.    
  2830.  
  2831. NOTE,    if the address register holds an odd value an odd offset will result
  2832.     in an even effective address and in that case the assemblers even
  2833.     checks will report errors on the instructions that will work and
  2834.     none on those who will crash. However, normally you do not use an
  2835.     odd address as base for word or longword accesses. Also, this option
  2836.     only make sense if you are using a 68000 processor, 68020 and
  2837.     upwards allow word and longword accesses to odd addresses.
  2838.  
  2839.  
  2840. Option F - Fast.
  2841.  
  2842. This is the assembler speed control option, e.g how to handle include
  2843. files.
  2844.  
  2845. F1+    When this option is activated the assembler will read all of the
  2846.     include files in one go and store them in memory for the second     
  2847.     pass. This uses up a lot of memory but it also speeds assembly,
  2848.     especially during pass 2.
  2849.  
  2850. F1-    When deactivated, the assembler will read include files in blocks of
  2851.     488 bytes and not store them in memory. This saves memory but it's 
  2852.     rather slow.
  2853.  
  2854. F2+    Tells the assembler NOT to read any include file during pass 2.
  2855.     Since all standard Amiga include-files only contain symbol
  2856.     definitions there is no need to even scan them during the second
  2857.     pass. This boosts assembly time during pass 2 a great deal.
  2858.     However, this option can't be used with include-files containing any
  2859.     code, of natural reasons.
  2860.  
  2861. F2-    Deactivates the 'read include-file in pass one only' option.
  2862.  
  2863. F3    Is not currently used.
  2864.  
  2865. This option should only be used once in the beginning of the main source
  2866. file.
  2867.  
  2868. Option    I - Immediate data check.
  2869.  
  2870. When this option is active the assembler will give an error on all
  2871. instructions using absolute long addressing as the source operand, unless
  2872. it's address 4, since the probable reason is a missing '#' (or perhaps a
  2873. missing address-register (An)). This is a useful option when checking for
  2874. typing errors. For example: 
  2875.  
  2876.     or.b    $20,d0
  2877.  
  2878. will give an error since the intended instruction was
  2879.  
  2880.     or.b    #$20,d0
  2881.  
  2882. You can force the assembler to use absolute addressing with the following:
  2883.  
  2884.     move.w    (custom+intenar).l,d0
  2885.  
  2886. Use OPT I+ to activate and OPT I- to deactivate. This option may be used as
  2887. often as you wish.
  2888.  
  2889. Option L - Linker mode
  2890.  
  2891. OPT L+ will cause the assembler produce linkable code, OPT L- will cause it
  2892. to produce executable code. This option MUST be specified before anything
  2893. else is done.
  2894. Option M - Macro expansion
  2895.  
  2896. Using OPT M+ will make the assembler list the instructions in macros, if
  2897. source-listing is on, when the macro is called. OPT M- will disable this.
  2898. Instructions in macros are preceded by a '+' in the listing.
  2899. The default setting for Option M is not in the Default Assembler Options
  2900. item but in the Default Program List Ctrl item, both in the Environment
  2901. menu. Only the last OPT M is taken into account.
  2902.  
  2903.  
  2904.  
  2905.  
  2906. Option O - Optimizing.
  2907.  
  2908. The assembler is capable of performing 8 different optimizations, causing
  2909. certain statements to be faster and smaller.
  2910.  
  2911.     OPT O+        will turn on  all optimizations and warnings.
  2912.     OPT O-        will turn off all optimizations and warnings.
  2913.     OPT OW+        will turn on  all warnings caused by optimization.
  2914.     OPT OW-        will turn off all warnings caused by optimization.
  2915.     OPT On+        will turn on  optimization n.
  2916.     OPT On-        will turn off optimization n.    
  2917.     OPT OWn+    will turn on  the warning for optimization n.
  2918.     OPT OWn-    will turn off the warning for optimization n.
  2919.  
  2920. If more than 100 optimizations are to be made you must turn off the
  2921. warnings or the assembler will abort with the error: 
  2922. "Maximum number of ERRORS/WARNINGS reached"
  2923.  
  2924. If any optimizing has been done the number of optimizations made and bytes
  2925. saved will be shown at the end of assembly.
  2926.  
  2927. Below is a list of the different optimizations with a description of what
  2928. they do:
  2929.  
  2930. OPT O1+    will optimize backward branches to short if in range.
  2931.     For example:
  2932.  
  2933.     loop    tst.b    (a2)+
  2934.         bne    loop
  2935.  
  2936.     will be optimized to
  2937.  
  2938.     loop    tst.b    (a2)+
  2939.         bne.s    loop
  2940.  
  2941.     NOTE, branches that are specified as word branches,
  2942.           e.g Bcc.w will not be optimized.
  2943.  
  2944. OPT O2+    will optimize address register indirect with displacement
  2945.     to address register indirect, if the displacement is zero.
  2946.     For example:
  2947.  
  2948.         tst.w    flag(a0)
  2949.  
  2950.     will be optimized to:
  2951.  
  2952.         tst.w    (a0)
  2953.  
  2954.     if the symbol flag is zero.
  2955.  
  2956. OPT O3+    will optimize absolute long addressing to absolute short
  2957.     if the address is within range; -32769 < d < 32768.
  2958.     For example:
  2959.  
  2960.         movea.l    4,a6
  2961.  
  2962.     will be optimized to
  2963.  
  2964.         movea.l    4.w,a6
  2965.  
  2966.     NOTE, if the address is specificly given as absolute long
  2967.     no optimization will be made.
  2968.  
  2969.  
  2970.  
  2971.  
  2972. OPT O4+    will optimize move.l #d,Dn to moveq #d,Dn if d is within
  2973.     range; -129 < d < 128.
  2974.     For example:
  2975.  
  2976.         move.l    #MEMF_PUBLIC,d0    ;MEMF_PUBLIC = 1
  2977.  
  2978.     will be optimized to
  2979.  
  2980.         moveq    #MEMF_PUBLIC,d0
  2981.  
  2982. OPT O5+    will optimize ADD and SUB instructions to the quick form
  2983.     if the source is an immediate number between 1 and 8.
  2984.     For example:
  2985.  
  2986.         add.b    #4,counter
  2987.  
  2988.     will be optimized to
  2989.  
  2990.         addq.b    #4,counter
  2991.  
  2992. OPT O6+    this is not really an optimization. If this option is
  2993.     active the assembler will give a warning on all branches
  2994.     that can be made short.
  2995.     For example:
  2996.  
  2997.         bne    no_return
  2998.         rts
  2999.     no_return    ...
  3000.  
  3001.     above the bne instruction will generate a warning. You can
  3002.     then yourself optimize it if you wish.
  3003.     NOTE, even on branches specified as word, e.g Bcc.w.
  3004.  
  3005. OPT O7+    will optimize backward absolute long addressing to 
  3006.     PC-relative if within range.
  3007.     For example:
  3008.  
  3009.     main    pea    main    ; push right return address
  3010.  
  3011.     will be optimized to
  3012.  
  3013.     main    pea    main(pc) ; push right return address
  3014.  
  3015.     NOTE, if the address is specificly given as absolute long
  3016.     no optimization will be made.
  3017.  
  3018. OPT O8+    This is not really an optimization. If active the
  3019.     assembler will give a warning on all instructions using
  3020.     absolute long addressing that can be made PC-relative.
  3021.     For example:
  3022.  
  3023.         lea    base,a6
  3024.         ..
  3025.         ..
  3026.     base    dc.l    0
  3027.  
  3028.     above the lea instruction will generate a warning. You can
  3029.     then yourself optimize it if you wish.
  3030.     NOTE, even on addresses specified as absolute long.
  3031.  
  3032. The default optimization may only be set to OPT O+ or OPT O- thus either
  3033. enabling or disabling all optimizations, and the same for the optimization
  3034. warnings OPT OW+ or OPT OW-.
  3035.  
  3036.  
  3037.  
  3038. Option P - Position independent checks.
  3039.  
  3040. If this option is enabled, with OPT P+, the assembler will give an error on
  3041. all instructions that require relocation. This way you can check if the
  3042. code MCAsm is producing is position-independent or not. This option can be
  3043. disabled with OPT P-, and you may use it as much as you like.
  3044.  
  3045. Option S - Symbol listing.
  3046.  
  3047. OPT S+ will enable the printing of a symbol-listing at the end of assembly
  3048. and OPT S- will disable this. Only the last used OPT S is taken into
  3049. account.
  3050.  
  3051. Option T - Type checking.
  3052.  
  3053. With this option active the assembler checks for correct use of symbols and
  3054. expressions.
  3055.  
  3056. start    equ    10
  3057.  
  3058.     bra    start
  3059.  
  3060. This is not allowed since the label is an absolute symbol and Bcc requires
  3061. a relative one.
  3062.  
  3063. start    move.l    start(a0),d0
  3064.  
  3065. This will also give an error since a displacement must be absolute
  3066. (not really, see Lattice users) and start is relative.
  3067. However, under certain circumstances the type-checking may be more of a
  3068. hindrance than a help so it can be disabled with OPT T- and enabled with 
  3069. OPT T+.
  3070.  
  3071. Option U - Underlines for local labels.
  3072.  
  3073. If you wish to use the underscore (_) rather than the dot (.) to introduce
  3074. a local label use OPT U+ in the beginning of the main source file.
  3075. The character used to introduce a local label always defaults to the
  3076. dot (.). This option should only be used once.
  3077.  
  3078. Option W - Warnings.
  3079.  
  3080. If you wish to disable the warnings produced by the assembler - use OPT W-,
  3081. and when you want to re-enable them use OPT W+. This option can be used as
  3082. much as you like.
  3083.  
  3084. Option X - Small debug.
  3085.  
  3086. This is a special version of Option D (debug) which only outputs the XDEFed
  3087. symbols in the debug-hunk. This option is only valid if producing linkable
  3088. code - there are no XDEF in executable code.
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104. Below is a summary of all the MCAsm options
  3105.  
  3106.     A    Automatic PC-relative addressing
  3107.     B    Automatic execution of BLOAD/BSAVE file-lists
  3108.     C    Case-sensitivity and significant characters
  3109.     D    Debug information (normal)    
  3110.     E    Check for even addresses
  3111.     F    Fast (how to handle include-files)
  3112.     I    Immediate data check
  3113.     L    Produce linkable or executable code
  3114.     M    List macro expansions
  3115.     O    Optimize
  3116.     P    Position independent checks
  3117.     S    Symbol-listing
  3118.     T    Type-checking
  3119.     U    Local label start character
  3120.     W    Warnings
  3121.     X    Small debug (only XDEFed symbols, only linkable code)
  3122.  
  3123.  
  3124. [<label>]    EVEN
  3125.  
  3126. This directive will force the program counter to be even. All instructions
  3127. and directives except DS.B, DC.B, DCB.B, RC.B and RCB.B are automatically
  3128. forced to an even address.
  3129.  
  3130. [<label>]    CNOP    <exp1>,<exp2>
  3131.  
  3132. CNOP is used to align code or data to any location you may want.
  3133. <exp2> is the base used to compute the boundary and <exp1> is an offset
  3134. from this boundary.
  3135.  
  3136.     CNOP    0,2    aligns to the next word
  3137.     CNOP    6,4    aligns to the next longword + 6
  3138.     CNOP    13,64    aligns to the next 64 byte boundary + 13
  3139.  
  3140. The start of each section is always guaranteed to be longword aligned.
  3141.  
  3142.     FAIL
  3143.  
  3144. This directive will force the assembler to produce an error.
  3145.  
  3146.     ILLEGAL
  3147.  
  3148. This directive will generate the standard user illegal opcode $4afc.
  3149.  
  3150.  
  3151.  
  3152.     2.10.2    Symbol definitions
  3153.  
  3154. <label>    EQU    <expression>
  3155.  
  3156. EQU assigns the value and type, absolute or relative, of the <expression>
  3157. in the operand field to the <label> and it is a permanent value, you can
  3158. not redefine the label any where else. Do not use forward references or
  3159. external symbols in the <expression>.
  3160.  
  3161. <label>    =    <expression>
  3162.  
  3163. Alternate form of EQU statement.
  3164.  
  3165. NOTE,    no <white space> is necessary with this form:
  3166.  
  3167. <label>=<expression>
  3168.  
  3169.  
  3170. <label>    SET    <expression>
  3171.  
  3172. SET assigns the value and type, absolute or relative, of the <expression>
  3173. in the operand field to the <label> and it is a temporary value, you can
  3174. redefine the label later in the program. Do not use forward references or
  3175. external symbols in the <expression>.
  3176.  
  3177. <label>    REG    <Reg-list>
  3178.  
  3179. This allows a symbol to be defined as a MOVEM register list. A symbol
  3180. defined with REG is treated as a permanent absolute symbol. However, in
  3181. MOVEM instructions, only symbols defined with REG are valid.
  3182.  
  3183. [<label>]    RS[<.size>]    <expression>
  3184.  
  3185. This directive lets you create lists of constant symbols, very useful when
  3186. creating structures referenced with register indirect with displacement
  3187. addressing. For example:
  3188.  
  3189.     rsreset
  3190. Next    rs.l    1
  3191. Flag    rs.b    1
  3192. Name    rs.b    32
  3193.  
  3194. can be accessed with
  3195.  
  3196.     movea.l    Next(a0),a1
  3197.     tst.b    Flag(a0)
  3198.     beq.s    ..
  3199.     lea    Name(a0),a2
  3200.  
  3201. When you use the directive the assembler assigns the current rs_counter
  3202. value, the type is absolute, to the optional <label> and then increments
  3203. the counter according to the <size> and the <expression>. <size> can be .L,
  3204. .W, .B or .S. If not specified .W is assumed. No code is generated by the
  3205. RS directive, only the <label> is defined. If you want to create
  3206. initialized structures you must use the RC directive described later.
  3207.  
  3208. [<label>]    RSSET    <expression>
  3209.  
  3210. This sets the rs_counter to the value of <expression>.
  3211.  
  3212. [<label>]    RSRESET
  3213.  
  3214. This resets the rs_counter to zero.
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.     2.10.3    Data definition
  3237.  
  3238. [<label>]    DC[<.size>]    <expression>[,<expression>]..
  3239.  
  3240. DC defines constants in memory. It may have one or more operands, separated
  3241. by commas (,). No more than 128 bytes can be defined with a single DC. If
  3242. the size is .B or .S then the data can also be an ASCII string.
  3243. For example:
  3244.  
  3245.     dc.b    'Hello World'
  3246.  
  3247. this will cause the ASCII string 'Hello World' to be defined in memory
  3248.  
  3249.     dc.b    'b'-'a'
  3250.  
  3251. this still works the 'normal' way and will produce one byte in memory with
  3252. the value 1.
  3253.  
  3254. Expressions and strings may be mixed in a single DC.B, separated with
  3255. commas (,).
  3256. The <size> is optional and can be .L, .W, .B or .S. If no size is given .W
  3257. is assumed.
  3258.  
  3259. [<label>]    DCB[<.size>]    <number>,<value>
  3260.  
  3261. This directive allows constant blocks to be defined with the specified
  3262. size. <number> specifies how many times <value> should be repeated.
  3263. The <size> is optional an can be .L, .W, .B or .S. If not specified .W is
  3264. assumed.
  3265. For example:
  3266.  
  3267.     dcb.b    80,0
  3268.     dcb.w    40,0
  3269.     dcb.l    20,0
  3270.  
  3271. These directives all create a block with 80 bytes of zero.
  3272.  
  3273. [<label>]    DS[<.size>]    <expression>
  3274.  
  3275. DS will reserve memory locations and the contents will not be initialized.
  3276. The <size> if optional and can be .L, .W, .B or .S. If not specified .W is
  3277. assumed.
  3278. For example:
  3279.  
  3280.     ds.b    80
  3281.     ds.w    40
  3282.     ds.l    20
  3283.  
  3284. These directives also create a block with 80 bytes (each) but this time the
  3285. blocks are not initialized, this is why DS directives are faster to
  3286. assemble than DCB directives. If you need to have the block initialised you
  3287. must use the DCB directive.
  3288.  
  3289. [<label>]    RCSET    <expression>
  3290.  
  3291. This directive sets the rc_base to the current value of the program counter
  3292. - <expression>.
  3293. The label is made relative and its value will be the same as rc_base.
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302. [<label>]    RCRESET
  3303.  
  3304. This directive sets the rc_base to the current value of the program
  3305. counter.
  3306.  
  3307. [<label>]    RC[<.size>]    <expression>[,<expression>]
  3308.  
  3309. This directive is a mixture of the RS and DC directives. If you use RC or
  3310. DC without the <label> there is no difference. The difference between these
  3311. two directives is how and to what the <label> is defined. With the DC
  3312. directive the label is set to the value the program counter had at the
  3313. start of the constant block being defined and the type is relative. With
  3314. the RC directive the label is first of all absolute as with RS, second -
  3315. the value of the label is computed as the current value of PC - rc_base.
  3316.  
  3317. [<label>]    RCB[<.size>]    <number>,<value>
  3318.  
  3319. This directive is a mixture of the RS and DCB directives. The operation of
  3320. the directive is the same as for DCB and the <label> assignment is made in
  3321. the same manner as described for the RC directive. 
  3322.  
  3323. A small example with the RC directive:
  3324.  
  3325. PC
  3326.  
  3327. 0000    base    rcset    -4    ; base = PC+4
  3328. 0000    l1    rc.l    0    ; l1 = -4
  3329. 0004                ; base actually points to this address
  3330. 0004        lea    base,a0    ; lea 4,a0
  3331. 0008        move.l    l1(a0),d0    ; l1 = -4 => l1(a0) = 0
  3332. 000c        move.l    l2(a0),d1    ; l2 = $c => l2(a0) = $12
  3333. 0010        rts
  3334. 0012    l2    rc.l    -1    ; l2 = $c
  3335.  
  3336. If you use a negative expression of -32768 in rcset you can use the whole
  3337. 64K area accessible by register indirect with displacement addressing.
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.     2.10.4    Repeat loops
  3369.  
  3370. Sometimes it is useful to be able to repeat instruction(s) a number of
  3371. times, and there are 3 different repeat directives to help you with this.
  3372. The instructions will be repeated the number of times specified in
  3373. <expression>. If <expression> is zero or negative nothing will be repeated.
  3374. It is not possible to nest repeat loops and no symbol definitions except
  3375. SET are allowed to prevent "Redefined symbol" errors, however SET is only
  3376. allowed in the general form of the repeat loop.
  3377.  
  3378. [<label>]    REPT    <expression>
  3379.         ENDR
  3380.  
  3381. This is the general form of the repeat loop. Instructions to be repeated
  3382. should be enclosed with REPT and ENDR.
  3383. For example, to create a table with constants from 3 to 90 step 3:
  3384.  
  3385. exp    set    3
  3386.     rept    30
  3387.     dc.l    exp
  3388. exp    set    exp+3
  3389.     endr
  3390.  
  3391. This form of the repeat loop is assembled each and every loop.
  3392.  
  3393. [<label>]    FREPT    <expression>
  3394.         ENDFR
  3395.  
  3396. This is the fast form of the repeat loop. Now the instructions are only
  3397. assembled once and them copied <expression> times to the code.
  3398. Instructions to be repeated should be enclosed with FREPT and ENDFR.
  3399.  
  3400.     frept    10
  3401.     move.l    d0,(a1)+
  3402.     move.l    base,(a1)+
  3403.     clr.l    (a1)+
  3404.     endfr
  3405.  
  3406. By natural causes the SET directive is not allowed in the FREPT loop, it is
  3407. only assembled once.
  3408.  
  3409. [<label>]    IREPT    <expression>
  3410.  
  3411. This is the immediate form of the repeat loop and only repeats the next
  3412. instruction, no END is necessary.
  3413.  
  3414.     irept    512/4
  3415.     move.l    (a0)+,(a1)+
  3416.     
  3417. Also, in the immediate form, instructions that require relocation are not
  3418. allowed.
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.     2.10.5    Macros
  3435.  
  3436. MCAsm is a macro assembler, which means that it can handle macros. Macros
  3437. is a way of referencing frequently used instructions with a single symbol.
  3438. The use of macros together with conditional assembly can make an assembler
  3439. programers life much easier. Before a macro can be used it must be defined,
  3440. and the directives below takes care of that.
  3441.  
  3442. <label>    MACRO
  3443.  
  3444. MACRO starts a macro definition. You must provide a symbol which the
  3445. assembler uses as the name of the macro. A macro can contain any opcode,
  3446. most directives and any already defined macro. Macro definitions may not be
  3447. nested.
  3448.  
  3449.     ENDM
  3450.  
  3451. This directive terminates a macro definition.
  3452.  
  3453.     MEXIT
  3454.  
  3455. This directive is used to exit a macro during expansion.
  3456.  
  3457.     NARG
  3458.  
  3459. This is not a directive but a symbol, holding the number of arguments
  3460. supplied to the current macro.
  3461.  
  3462.  
  3463.  
  3464. Once a macro has been defined, you should only define a macro once, if may
  3465. be called upon as many times as you wish and you may append a number of
  3466. arguments (max 36  0-9 a-z or A-Z), separated by commas (,). The symbol
  3467. backslash (\) has a special meaning. Backslash followed by a number "n"
  3468. (0-9 a-z or A-Z) tells the assembler to replace the \n with the nth
  3469. argument supplied to the macro when called or with nothing if the requested
  3470. parameter is missing. Argument 0 is the size specification on the macro and
  3471. arguments 1 - z are the arguments supplied as operands to the macro.
  3472. If no size is specified argument 0 defaults to 'w'. A true \ may be
  3473. included by specifying \\. If a macro parameter is to include a space or a
  3474. tab then the parameter must be enclosed within angled brackets (< and >)
  3475. and in this case a true > may be included by specifying >>.
  3476.  
  3477. Macro calls may be nested as long as there is enough memory so recursion is
  3478. allowed if required.
  3479.  
  3480. There is special parameter starting with a backslash followed by "@". This
  3481. sequence, \@, tells the assembler to generate the text "_nnnn" (or .nnnn if
  3482. the underscore is used to introduce local labels), where nnnn is the macro
  3483. call counter, in hexadecimal. This is used to generate unique labels within
  3484. a macro.
  3485.  
  3486. A special form allows the conversion of a symbol to ASCII decimal,
  3487. hexadecimal or binary using the syntax \<symbol> for decimal, \<$symbol>
  3488. for hex and \<%symbol> for binary. The symbol must be defined when the
  3489. macro is expanded.
  3490.  
  3491. Normally the assembler only shows the macro name in the source listing by
  3492. if you wish to list the entire macro use OPT M+ or FORMAT 4+. All
  3493. instructions/directives in a macro is preceded with a '+' in the
  3494. source-listing.
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500. A few examples with macros:
  3501.  
  3502. The normal way to call a library is:
  3503.  
  3504.     movea.l    library_base,a6
  3505.     jsr    _LVOfunction(a6)
  3506.  
  3507. now, this can be done a little easier with a macro:
  3508.  
  3509. CALL    macro
  3510.     movea.l    \1,a6
  3511.     jsr    _LVO\2(a6)
  3512.     endm
  3513.  
  3514. first define the macro
  3515.  
  3516.     CALL    library_base,function
  3517.  
  3518. then use it. Now let's se what happens; the assembler finds the symbol CALL
  3519. in the macro table and it then scans the rest of the line to obtain the
  3520. parameters supplied to the macro - and in this example:
  3521.  
  3522.     \0    w
  3523.     \1    library_base
  3524.     \2    function
  3525.  
  3526. after the assembler has inserted the parameters the macro looks like this
  3527.  
  3528.     movea.l    library_base,a6
  3529.     jsr    _LVOfunction(a6)
  3530.     endm
  3531.  
  3532. the macro is assembled and when the assembler finds the endm directive it
  3533. resumes on the line after the line with the macro.
  3534.  
  3535. Calling the library functions may be made even easier if you make special
  3536. macros for each library and perhaps you want to save a6 as well:
  3537.  
  3538. CALL_EXEC    macro
  3539.         move.l    a6,-(sp)
  3540.         movea.l    4.w,a6
  3541.         jsr    _LVO\1(a6)
  3542.         movea.l    (sp)+,a6
  3543.         endm
  3544.  
  3545. When this macro is used you do not need to specify which library, it always
  3546. calls exec. For example, to allocate some memory:
  3547.  
  3548.     moveq    #MEMF_CHIP,d1
  3549.     moveq    #100,d0
  3550.     CALL_EXEC    AllocMem
  3551.     tst.l    d0
  3552.     beq    error
  3553.     ..
  3554.  
  3555. NOTE,    macros are no subroutines. Every time you use a macro it is
  3556.     assembled and produce some code. If you have large macros, e.g
  3557.     macros that produce much code, that only use a few or none arguments
  3558.     and you use them heavily you should consider making them subroutines
  3559.     instead.
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566. This example creates a macro that can do both ADDQ and SUBQ, depending on
  3567. the parameters supplied:
  3568.  
  3569. chgq    macro
  3570.     iifeq    \2
  3571.     mexit
  3572.     iflt    \2
  3573.     subq.\0    #-(\2),\1
  3574.     else
  3575.     addq.\0    #\2,\1
  3576.     endc
  3577.     endm
  3578.  
  3579. and use it like this:
  3580.  
  3581.     chgq.w    d0,-1    ; decrease d0.w with one
  3582.     chgq.l    a4,4    ; increase a4.l with 4
  3583.  
  3584. The macro first checks if the value to be added/subtracted is zero, if this
  3585. is the case then the macro is terminated with the mexit directive.
  3586. Next it checks if the value is negative, if so a subq is assembler, else an
  3587. addq is assembled. Let's see what happens in the two examples above:
  3588.  
  3589.     chgq.w    d0,-1
  3590.  
  3591. the parameters are:    \0    w
  3592.             \1    d0
  3593.             \2    -1
  3594.  
  3595. when the parameters are inserted the macro looks like this:
  3596.  
  3597.     iifeq    -1    ; is -1 EQ to 0
  3598.     mexit        ; no, so don't terminate
  3599.     iflt    -1    ; is -1 LT to 0
  3600.     subq.w    #-(-1),d0    ; Yes, insert parameters, -(-1) = 1
  3601.     else        ; toggle condition
  3602.     addq.\0    #\2,\1    ; nothing is done
  3603.     endc        ; end condition
  3604.     endm        ; end macro
  3605.  
  3606. the other example:
  3607.  
  3608.     chgq.l    a4,4
  3609.  
  3610. the parameters are:    \0    l
  3611.             \1    a4
  3612.             \2    4
  3613.  
  3614. and the macro looks like this with the parameters inserted:
  3615.  
  3616.     iifeq    4    ; is 4 EQ to 0
  3617.     mexit        ; no, so don't terminate
  3618.     iflt    4    ; is 4 LT to 0
  3619.     subq.\0    #-(\2),\1    ; no, so do nothing
  3620.     else        ; toggle condition
  3621.     addq.l    #4,a4    ; insert parameters
  3622.     endc        ; end condition
  3623.     endm        ; end macro
  3624.  
  3625. NOTE,    if a subtraction is to be made, the value must start with a minus
  3626.     (-) or an error will occur when the parameter is inserted in the
  3627.     subq instruction.
  3628.  
  3629.  
  3630.  
  3631.  
  3632.     2.10.6    Listing control
  3633.  
  3634.     PAGE
  3635.  
  3636. Cause a new page in the listing to be started, if paging is enabled.
  3637.  
  3638.     NOPAGE
  3639.  
  3640. The NOPAGE directive disables the printing of page headers.
  3641.  
  3642.     PAGEON
  3643.  
  3644. The PAGEON directive re-enables the printing of page headers.
  3645.  
  3646.     LIST
  3647.  
  3648. This will turn the source-listing on. If source-listing was selected at the
  3649. start of assembly the listing will be outputed to whatever device selected
  3650. or else to the screen. You can also change the source-listing  counter with
  3651. LIST + and LIST -. LIST + adds 1 to the counter and LIST - subtracts 1. If
  3652. the counter is zero or positive source-listing is on, if it is negative
  3653. source-listing is off. The normal LIST sets the counter to 0.
  3654. The default starting value (e.g no source-list) is -1, if source listing is
  3655. initially selected the starting value is 0. This system allows greater
  3656. control over the source-listing being or not being.
  3657.  
  3658.     NOLIST
  3659.  
  3660. This will turn of the source-listing. (putting -1 in the source-listing
  3661. counter).
  3662.  
  3663.     TTL    <string>
  3664.  
  3665. This will set the title printed at top of each page to <string>. Only the
  3666. first encountered TTL is used. If no title is specified the filename of the
  3667. source file is used.
  3668.  
  3669.     SUBTTL    <string>
  3670.  
  3671. This will set the sub-title printed at top of each page to <string>. Only
  3672. the first encountered SUBTTL is used. If no sub-title is specified nothing
  3673. is printed.
  3674.  
  3675.     PLEN    <expression>
  3676.  
  3677. This will set the page length of the source- and symbol-listing to
  3678. <expression> and it defaults to 60.
  3679.  
  3680.     LLEN    <expression>
  3681.  
  3682. This will set the line width of the source- and symbol-listing to
  3683. <expression> and it defaults to 132. The <expression> must be between 38
  3684. and 511. (if the listing is sent to the screen llen is always 80).
  3685.  
  3686.     SPC    <expression>
  3687.  
  3688. This will output <expression> number of blank lines in the source-listing.
  3689. That is, if source-listing is enabled.
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.     LISTCHAR    <expression>[,<expression>]...
  3699.  
  3700. This will send the <expression>(s) to the listing device (if not the
  3701. screen) and is intended to do things as setting the margins, character mode
  3702. etc on the printer.
  3703.  
  3704.         FORMAT    <option>[,<option>]...
  3705.  
  3706. This allows control over the listed format. Each <option> controls a field
  3707. in the listing.
  3708.  
  3709.     0-    line number off
  3710.     0+    line number on
  3711.     1-    PC off
  3712.     1+    PC on ( in hex )
  3713.     1++    PC on ( in dec )
  3714.     1+++    PC on ( in hex and dec )
  3715.     2-    hex data off
  3716.     2+    5 words of hex data
  3717.     2++    3 words of hex data
  3718.     2+++    1 word of hex data
  3719.     3-    list off in include-files
  3720.     3+    list on in include-files
  3721.     4-    list off in macros (equal to opt m-)
  3722.     4+    list on in macros (equal to opt m+)
  3723.     5-    don't increase line number in include-files
  3724.     5+    increase line number in include-files
  3725.     6-    don't increase line number in macros
  3726.     6+    increase line number in macros
  3727.     7-    don't show flags
  3728.     7+    show flags
  3729.     8-    don't show execution time
  3730.     8+    show execution time
  3731.     9-    tabs to spaces
  3732.     9+    tabs to tabs
  3733.     A-    don't show symbol value ( in symbol listing )
  3734.     A+    show symbol value in hex ( in symbol listing )
  3735.     A++    show symbol value in dec ( in symbol listing )
  3736.     A+++    show symbol value in hex and dec ( in symbol listing )
  3737.     B-    don't show symbol type ( in symbol listing)
  3738.     B+    show symbol type ( in symbol listing )
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.     2.10.7    Conditional assembly
  3765.  
  3766. There are a wide range of directives concerning conditional assembly.
  3767. At the start of a conditional block there is always one of many IFcc
  3768. directives and at the end mostly a ENDC or ENDIF.
  3769.  
  3770.     IFEQ    <expression>
  3771.     IFNE    <expression>
  3772.     IFGT    <expression>
  3773.     IFGE    <expression>
  3774.     IFLT    <expression>
  3775.     IFLE    <expression>
  3776.     IF    <expression>
  3777.  
  3778. NOTE,    IF is a short form for IFNE.
  3779.  
  3780. These directives will evaluate and compare <expression> with zero and then
  3781. turn assembly on or off depending on the result. The conditions correspond
  3782. exactly to the 68000 condition codes. For example:
  3783.  
  3784.     ifeq    do_what
  3785.     addq.l    #1,d0
  3786.     endc
  3787.     ifne    do_what
  3788.     subq.l    #1,d0
  3789.     endc
  3790.  
  3791. If do_what is 0 the first condition will turn assembly on as 0 is EQ to 0
  3792. and thereby increasing d0 with one, the second condition will not turn
  3793. assembly on as 0 is NE to 0. The summary of it all is; if do_what is zero
  3794. d0 will be increased with one, for all other values on do_what d0 will be
  3795. decreased by one. Endc will terminate each condition.
  3796.  
  3797.     IFC    '<string>','<string>'
  3798.  
  3799. This directive compares two strings, both must be enclosed within single or
  3800. double quotes, and if they are equal assembly will by turned on, else
  3801. assembly is turned off.
  3802.  
  3803.     IFNC    '<string>','<string>'
  3804.  
  3805. This directive also compares two enclosed strings, but now assembly is
  3806. turned on if the strings are not equal and off if they are equal.
  3807.  
  3808.     IFD    <symbol>
  3809.  
  3810. This directive will turn on assembly if the <symbol> is defined, else
  3811. assembly is turned off.
  3812.  
  3813.     IFND    <symbol>
  3814.  
  3815. This directive will turn on assembly if the <symbol> is not defined, else
  3816. assembly is turned off.
  3817.  
  3818.  
  3819.     ENDC
  3820.     ENDIF
  3821.  
  3822. These directives will terminate the current level of conditional assembly.
  3823. If the assembler finds more ENDC/ENDIF than it has previously found IFcc or
  3824. if the number of IFccs doesn't match the number of ENDC/ENDIfs at the end
  3825. off assembly, an error is given.
  3826.  
  3827.  
  3828.  
  3829.  
  3830.     ELSEIF
  3831.     ELSE
  3832.  
  3833. These two directives toggles conditional assembly from on to off or vice
  3834. versa. For example, another way to write the example used earlier in this
  3835. section:
  3836.  
  3837.     ifeq    do_what
  3838.     addq.l    #1,d0
  3839.     elseif
  3840.     subq.l    #1,d0
  3841.     endc
  3842.  
  3843. If do_what is 0 the condition will turn assembly on as 0 is EQ to 0 and
  3844. thereby increasing d0 with one, then elseif will toggle the conditional
  3845. assembly to off, the subq will not be assembled and endc terminates the
  3846. condition. If do_what is not 0 the condition will turn assembly off, elseif
  3847. will turn it on and therefore assemble the subq. Endc will terminate the
  3848. condition.
  3849.  
  3850.     IIF    <expression>
  3851.     IIFEQ    <expression>
  3852.     IIFNE    <expression>
  3853.     IIFGT    <expression>
  3854.     IIFGE    <expression>
  3855.     IIFLT    <expression>
  3856.     IIFLE    <expression>
  3857.     IIFC    '<string>','<string>'
  3858.     IIFNC    '<string>','<string>'
  3859.     IIFD    <symbol>
  3860.     IIFND    <symbol>
  3861.  
  3862. These are the immediate forms of the IFcc directives and they are only
  3863. effective on the next instruction. No ENDC, ENDIF, ELSE or ELSEIF should be
  3864. used with the immediate forms. So - yet another version of the example used
  3865. earlier:
  3866.  
  3867.     iifeq    do_what
  3868.     addq.l    #1,d0
  3869.     iifne    do_what
  3870.     subq.l    #1,d0
  3871.  
  3872. If do_what is 0 the first condition will turn assembly on as 0 is EQ to 0,
  3873. the second condition will not turn assembly on as 0 is NE to 0. The summary
  3874. of it all is still the same but now in only 4 lines.
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.     2.10.8    Section control
  3897.  
  3898.     SECTION     <name>[,<type>,<code_size>,<reloc_size>,<extern_size>]
  3899.  
  3900. This directive switches to the section <name> or if this is the first time
  3901. it's encountered, defines it. A program may consist of many sections which
  3902. will be put together with other sections with the same name by the linker.
  3903. The section name can be 32 characters and if it contains a space it should
  3904. be enclosed within single of double quotes. The casing of the name is
  3905. significant. The <type> can be one of the following and if no type is given
  3906. CODE is selected.
  3907.  
  3908.     CODE    code section, public memory
  3909.     CODE_C    code section, chip memory
  3910.     CODE_F    code section, fast memory
  3911.     DATA    data section, public memory
  3912.     DATA_C    data section, chip memory
  3913.     DATA_F    data section, fast memory
  3914.     BSS    bss  section, public memory
  3915.     BSS_C    bss  section, chip memory
  3916.     BSS_F    bss  section, fast memory
  3917.  
  3918. CODE sections are used for executable code, DATA sections for initialised
  3919. data and BSS sections for un-initialised data.
  3920. CODE & DATA sections can contain any directive, BSS only DS.
  3921. BSS sections take no disk-space. Only the bss_hunk and length is saved.
  3922. When loading the area allocated is always filled with zero.
  3923.  
  3924. <code_size> is the size of the code buffer, in bytes. If not present the
  3925. default section size will be used.
  3926.  
  3927. <reloc_size> is the size of the reloc-hunk buffer, in bytes. If not present
  3928. reloc_size is computed as 1/5 of the code_size.
  3929.  
  3930. <extern_size> is the size of the ext-hunk buffer, in bytes. If not present
  3931. extern_size is computed as 1/5 of the code_size.
  3932. For example:
  3933.  
  3934.     section    text,code_c,50000,,3000
  3935.  
  3936. This defines a code_c section with the name text, code_size is 50000,
  3937. reloc_size is 10000 (50000/5) and extern_size is 3000.
  3938.  
  3939.     CODE/DATA/BSS
  3940.  
  3941. These directives are for compatibility only. They are the same as
  3942. specifying the directive as the section name and type.
  3943.  
  3944.     OFFSET    <expression>
  3945.  
  3946. This switches to a special section to generate absolute labels. The
  3947. <expression>, if given, sets the program counter for the start of this
  3948. section. No code is generated and the only directive allowed is DS.
  3949. For example, to define some 68000 vectors:
  3950.  
  3951.         offset    0
  3952. initial_sp    ds.l    1
  3953. initial_pc    ds.l    1
  3954. bus_error    ds.l    1
  3955. address_error    ds.l    1
  3956. illegal_instr    ds.l    1
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.     2.10,9   Linkable directives                                              
  3963.  
  3964.     XDEF    <label>[,<label>]..
  3965.  
  3966. This defines the <label>(s) listed for export to other programs or
  3967. sections. It is not possible to export local labels or temporary symbols.
  3968. It's only effective if the code type is linkable. You should not XDEF a
  3969. label more than once, if you do you will get a 'Redefined symbol error'
  3970. when linking.
  3971.  
  3972.     XREF[.R|.A|.L]    <symbol>[,<symbol>]..
  3973.  
  3974. This defines symbols to be imported from other programs or sections.
  3975. It's only effective if the code type is linkable. The type may be .R for
  3976. relative imports and .L or .A for absolute imports. A XREF without any type
  3977. defines un-typed imports that may be used either as relatives or absolutes.
  3978. If you try to XREF a symbol that has already been defined you will get a
  3979. 'Redefined symbol error'. The same will happen if you XREF the same symbol
  3980. more than once.
  3981.  
  3982.     IDNT    <string>
  3983.  
  3984. This will set the hunk_unit name to <string>. The name can be 32 characters
  3985. long and if it contains spaces or tabs it should be enclosed within single
  3986. or double quotes.
  3987.  
  3988.  
  3989.  
  3990.     2.10.10    Binary include
  3991.  
  3992.     INCBIN    <filename>
  3993.  
  3994. This takes the file <filename> and includes it, binary, in the code at the
  3995. current position. The data is always put on an even address and if the file
  3996. is an odd number of bytes in length it is padded to an even length.
  3997. If <filename> contains a space it should be enclosed in single or double
  3998. quotes. See INCLUDE for a more detailed description on where the assembler
  3999. looks for the file.
  4000.  
  4001.     BLOAD    <filename>,<start>[,<end>]
  4002.  
  4003. BLOAD loads binary data into the code starting at address <start>. If the
  4004. <end> address is given the maximum file-length will be limited to
  4005. <end>-<start>, else the entire file is loaded. If a space or tab is to be
  4006. included in the <filename> it must be enclosed with single or double
  4007. quotes. Since the data isn't loaded until after assembly the complete 
  4008. file-name must be specified, e.g df0:graphics/lo-res/picture1. BLOAD does
  4009. not reserve any memory for the data it loads, you must do so. For example:
  4010.  
  4011. gfx    ds.b    1000
  4012.     bload    df0:graphics/font,gfx
  4013.  
  4014. The BLOAD directive must be placed in that same section as the destination
  4015. of the data it is going to load, otherwise you will get a warning. If you
  4016. do - do not execute the BLOAD list, the data may end up outside the area
  4017. allocated for the section. However, if you are writing absolute code this
  4018. might be just what you want. At last, BLOAD directives should be used, or
  4019. to be correct, executed with care. Also - see Warning 04.
  4020.  
  4021.     BSAVE    <filename>,<start>,<end>
  4022.  
  4023. The same as BLOAD but this saves data instead, and <end> is not optional.
  4024.  
  4025.  
  4026.  
  4027.  
  4028.     2.10.11    Absolute directives
  4029.  
  4030.     ORG    <expression>
  4031.  
  4032. This directive is only effective if the code type is absolute, if the code
  4033. type is executable or linkable you will get a warning and then the
  4034. directive is ignored. ORG will set the program counter to the value of
  4035. <expression> which must evaluate and be absolute.
  4036.  
  4037.     ENT    <expression>
  4038.  
  4039. This directive is only effective if the code type is absolute, if the code
  4040. type is executable or linkable you will get a warning and then the
  4041. directive is ignored. ENT will set the program counter to the value of
  4042. <expression> which must evaluate and be absolute.
  4043.  
  4044.     INITREG    xn=<expression>
  4045.  
  4046. This directive is only effective if output is memory. It is used to 
  4047. pre-load data-registers d0-d7 or address-registers a0-a6 with the value
  4048. <expression>. All data and address registers, except a7, are cleared by
  4049. default before executing any code.
  4050.  
  4051. [<label>]    ALLOC    <address>,<size>
  4052.  
  4053. This is to make memory allocation easier. You can make a list of what
  4054. memory you need in your source and then the assembler tries to allocate it
  4055. the first time you assemble the source. If successful the allocated area is
  4056. stored in the Allocators AllocMemList so that the assembler doesn't try to
  4057. allocate the same area twice but take the address and size from the list in
  4058. sequel assemblies. If the assembler can't allocate the area it will abort
  4059. with a fatal error. If a label is present the address of the allocated area
  4060. is assigned to the label and the type is absolute. Memory allocated with
  4061. the ALLOC directive can be freed with the Allocator in the usual way.
  4062.  
  4063.  
  4064.  
  4065.     2.10.12    Output directive
  4066.  
  4067.     OUTPUT    <filename>
  4068.  
  4069. This directive defines the output filename. If the output filename is
  4070. already defined you will get a warning and then the directive is ignored.
  4071. See section 3.3 Output code-type and destination for a more detailed
  4072. description on how the output filename is built up.
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.     2.11    Errors and warnings
  4095.  
  4096. This section lists all the errors and warnings and gives a short
  4097. description of what that might have caused the error or warning.
  4098. A fatal error means that assembly will be aborted if the error occur.
  4099.  
  4100.  
  4101. *** Error 01: Symbol table is full.
  4102.  
  4103. Fatal error. The allocated symbol table is full and you must increase it.
  4104. This is done in the Specify Symbol Table item in the Environment menu.
  4105.  
  4106.  
  4107. *** Error 02: Break.
  4108.  
  4109. Fatal error. You pressed break - CTRL C.
  4110.  
  4111.  
  4112. *** Error 03: FREPT buffer is full.
  4113.  
  4114. Fatal error. The fast-repeat code buffer is full. The only thing you can do
  4115. about this is to have less instructions/directives in this FREPT-loop.
  4116. The size of the FREPT buffer is 128 bytes.
  4117.  
  4118.  
  4119. *** Error 04: Can't allocate macro expansion space.
  4120.  
  4121. Fatal error. Allocation memory for a macro expansion failed. This is
  4122. usually a very small amount and therefore this error should never occur,
  4123. but if it does - you are really out of memory.
  4124.  
  4125.  
  4126. *** Error 05: Error reading include file.
  4127.  
  4128. Fatal error. The assembler can't read an include file, probably due to
  4129. disk-failure.
  4130.  
  4131.  
  4132. *** Error 06: Error writing to symbol file.
  4133.  
  4134. Fatal error. The assembler can't write the symbol listing to the specified
  4135. file, normally because the disk is full but it may be something else.
  4136.  
  4137.  
  4138. *** Error 07: Error writing to list file.
  4139.  
  4140. Fatal error, same as Error 06 but this concerns the source listing file.
  4141.  
  4142.  
  4143. *** Error 08: Error writing to error file.
  4144.  
  4145. Fatal error, same as Error 06 but this concerns the error listing file.
  4146.  
  4147.  
  4148. *** Error 09: Not enough memory for include file buffer.
  4149.  
  4150. Fatal error. Allocating space for an include-file failed. This error should
  4151. only occur if you are using OPT F1+, if so - try F1-, else you are really
  4152. out of memory.
  4153.  
  4154.  
  4155. *** Error 10: Symbol storage buffer is full.
  4156.  
  4157. Fatal error. The symbol storage buffer, where the actual symbol names are
  4158. held, is full. Proceed as with Error 01.
  4159.  
  4160. *** Error 11: Macro table is full.
  4161.  
  4162. Fatal error. The allocated macro table is full and you must increase it.
  4163. This is done in the Specify Macro Table item in the Environment menu.
  4164.  
  4165.  
  4166. *** Error 12: Macro storage buffer is full.
  4167.  
  4168. Fatal error. The macro storage buffer, where the actual macro is held, is
  4169. full. Proceed as with Error 11.
  4170.  
  4171.  
  4172. *** Error 13: Maximum number of ERRORS/WARNINGS reached.
  4173.  
  4174. Fatal error. The assembler have had enough and aborts, e.g 101 errors
  4175. and/or warnings have been detected. Deal with those first.
  4176.  
  4177.  
  4178. *** Error 14: REPT buffer is full.
  4179.  
  4180. Fatal error. The REPT directive's source code buffer is full. You must use
  4181. less instructions/directives in this REPT-loop.
  4182.  
  4183.  
  4184. *** Error 15: Allocated code buffer is full.
  4185.  
  4186. Fatal error. The code buffer allocated is full. If you are writing absolute
  4187. code you must allocate a larger area. If writing executable or linkable you
  4188. must increase the size of the code buffer requested when defining this
  4189. section or increase the Default Section Size in the Environment menu.
  4190.  
  4191.  
  4192. *** Error 16: Can't allocate code buffer.
  4193.  
  4194. Fatal error. The area you want is to large, try a smaller if possible,
  4195. if not - you must either remove something else from memory or buy more!!
  4196.  
  4197.  
  4198. *** Error 17: Can't open output file.
  4199.  
  4200. Fatal error. The assembler can not open the output file you have specified.
  4201. The reasons may be many but must likely an invalid file-name.
  4202.  
  4203.  
  4204. *** Error 18: Can't allocate reloc buffer.
  4205.  
  4206. Fatal error, same as Error 16 but this is about the reloc-buffer.
  4207.  
  4208.  
  4209. *** Error 19: Can't allocate extern buffer.
  4210.  
  4211. Fatal error, same as Error 16 but this is about the external-buffer.
  4212.  
  4213.  
  4214. *** Error 20: Allocated reloc buffer is full.
  4215.  
  4216. Fatal error. The buffer allocated for reloc-information is full. You must
  4217. increase the size of the reloc buffer requested when defining this section
  4218. or increase the Default Section Size in the Environment menu.
  4219.  
  4220.  
  4221. *** Error 21: Allocated extern buffer is full.
  4222.  
  4223. Fatal error, same as Error 20 but this goes for the external buffer.
  4224.  
  4225.  
  4226. *** Error 22: Missing operands.
  4227.  
  4228. You have forgotten to specify one or more operands needed by the
  4229. instruction/directive in question. For example:
  4230.  
  4231.     MOVE.L    D0    ; to what? - destination missing
  4232.  
  4233.  
  4234. *** Error 23: To many operands.
  4235.  
  4236. This time you have specified to much. This error will only occur if a DC
  4237. directive becomes more than 128 bytes. Simply make two of it and the error
  4238. is gone.
  4239.  
  4240.  
  4241. *** Error 24: Invalid operand.
  4242.  
  4243. The operand(s) specified are not valid for this instruction. For example:
  4244.  
  4245.     DIVU    #10,A0    or    BRA.S    10(A0,D0.L)
  4246.  
  4247.  
  4248. *** Error 25: Value out of range.
  4249.  
  4250. This is the general 'Value out of range' error and it is reported where the
  4251. more specific forms do not fit in. For example:
  4252.  
  4253.     PLEN    -1000
  4254.  
  4255.  
  4256. *** Error 26: XREF symbols not allowed here.
  4257.  
  4258. You will get this error if you use a label defined with XREF in an EQU or
  4259. SET expression.
  4260.  
  4261.  
  4262. *** Error 27: A non SET symbol can not be redefined by SET.
  4263.  
  4264. This will happen if you try to SET a symbol that has not originally been
  4265. defined by SET. For example:
  4266.  
  4267. symbol        EQU    10
  4268. symbol        SET    20
  4269.  
  4270.  
  4271. *** Error 28: 8-bit displacement value out of range.
  4272.  
  4273. The displacement value is simple to big for 8 bits (signed). For example:
  4274.  
  4275.     JSR    130(A0,D0.W)
  4276.  
  4277.  
  4278. *** Error 29: Location out of range for short branch.
  4279.  
  4280. To far away, use a word branch.
  4281.  
  4282.  
  4283. *** Error 30: Location out of range for word branch.
  4284.  
  4285. The location is more than 32k away. You must use JMP, or JSR if the branch
  4286. was a BSR.
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292. *** Error 31: Number to large for 16-bit integer.
  4293.  
  4294. For example:    MOVE.W    #100000,D0
  4295.  
  4296.  
  4297. *** Error 32: number to large for 8-bit integer.
  4298.  
  4299. For example:    MOVE.B    #256,D1
  4300.  
  4301.  
  4302. *** Error 33: ENDC without matching IFcc.
  4303.  
  4304. This error is give if an ENDC or ENDIF is found without a matching IFcc, or
  4305. simpler - there are more ENDC/ENDIF than there are IFcc. This is most
  4306. likely to happen if you are writing a program with a lot of nested
  4307. conditions.
  4308.  
  4309.  
  4310. *** Error 34: End of file without matching ENDC.
  4311.  
  4312. This is the other way around, now you have more IFcc than ENDC/ENDIF
  4313.  
  4314.  
  4315. *** Error 35: ENDM without any macro being defined.
  4316.  
  4317. If the assembler finds a lonely ENDM it will give this error.
  4318.  
  4319.  
  4320. *** Error 36: Missing symbol for assignment.
  4321.  
  4322. If you don't supply a symbol to a directive that needs one this error will
  4323. be reported. For example:
  4324.  
  4325.     EQU    10    ; EQU what?
  4326.  
  4327.  
  4328. *** Error 37: Invalid arithmetic operand.
  4329.  
  4330. If the assembler finds an operand that it can not handle it will give you
  4331. this error. Note, normally this is due to typing errors. For example:
  4332.  
  4333.     MOVE.L    #mask\op,D0    ; should have been | - missed shift.
  4334.  
  4335.  
  4336. *** Error 38: Unbalanced parentheses.
  4337.  
  4338. This is just what it says; for example:
  4339.  
  4340.     MOVE.L    10*((2+2),D0
  4341.  
  4342.  
  4343. *** Error 39: Illegal decimal character.
  4344.  
  4345. This error is reported if a character not valid for a decimal number, e.g
  4346. outside 0 - 9, is present in a decimal number. For example:
  4347.  
  4348.     MOVE.L    #1234a,D0
  4349.  
  4350.  
  4351. *** Error 40: Illegal hexadecimal character.
  4352.  
  4353. This error is reported if a character not valid for a hexadecimal number,
  4354. e.g outside 0 - 9, A - F, a - f, is present in a hexadecimal number.
  4355. For example:
  4356.  
  4357.  
  4358. *** Error 41: Illegal binary character.
  4359.  
  4360. This error is reported if any other character than 0 and 1 is found in a
  4361. binary number. For example:
  4362.  
  4363.     MOVE.L    #%10010k,D0
  4364.  
  4365.  
  4366. *** Error 42: MEXIT outside macro.
  4367.  
  4368. This error will be reported if the assembler finds a MEXIT that is not
  4369. within a macro.
  4370.  
  4371.  
  4372. *** Error 43: user error.
  4373.  
  4374. This error is a result of the FAIL directive. For example:
  4375.  
  4376.     FAIL
  4377.  
  4378.  
  4379. *** Error 44: Illegal option selected.
  4380.  
  4381. If you request an option that the assembler do not support, it will respond
  4382. with this error. For example:
  4383.  
  4384.     OPT    K+
  4385.  
  4386.  
  4387. *** Error 45: Expression missing.
  4388.  
  4389. This error will only occur if you leave out an expression in a DC.
  4390. For example:
  4391.  
  4392.     DC.B    10,,20
  4393.  
  4394.  
  4395. *** Error 46: BSS and OFFSET sections can not contain data.
  4396.  
  4397. You will get this error if you try to use a code generating directive or an
  4398. instruction in a BSS or OFFSET section.
  4399.  
  4400.  
  4401. *** Error 47: End of file with open REPEAT.
  4402.  
  4403. This error will be reported if end of file is reached before an END-REPEAT
  4404. in a REPEAT-loop.
  4405.  
  4406.  
  4407. *** Error 48: REPEAT inside a REPEAT.
  4408.  
  4409. You will get this error if you try to nest REPEAT-loops.
  4410.  
  4411.  
  4412. *** Error 49: END-REPEAT without REPEAT.
  4413.  
  4414. If the assembler finds an END-REPEAT and no REPEAT has been specified this
  4415. error will be reported.
  4416.  
  4417.  
  4418. *** Error 50: SET definitions only in REPT - ENDR.
  4419.  
  4420. This will happen if you try to use a SET directive in a FREPT or IREPT
  4421. loop.
  4422.  
  4423.  
  4424. *** Error 51: Macro definitions not allowed in REPEAT.
  4425.  
  4426. This error will be given it you try do define any macro in a REPEAT loop.
  4427.  
  4428.  
  4429. *** Error 52: Label definitions not allowed in REPEAT.
  4430.  
  4431. For example:
  4432.  
  4433.     REPT    10
  4434. start    ...        ; this will give the error
  4435.  
  4436.  
  4437. *** Error 53: Permanent symbol definitions not allowed in REPEAT.
  4438.  
  4439. For example:
  4440.  
  4441.     REPT    10
  4442. test    EQU    4    ; this will give the error
  4443.  
  4444.  
  4445. *** Error 54: Unable to open include file.
  4446.  
  4447. If the assembler for some reason can't open the include-file requested it
  4448. will report this error. The most likely reason is a mistyped filename or a
  4449. wrong directory path.
  4450.  
  4451.  
  4452. *** Error 55 Unknown instruction/directive.
  4453.  
  4454. If the assembler finds an operation that is not one of the built in
  4455. instructions/directives and that is not listed as a macro; then this error
  4456. will be reported.
  4457.  
  4458.  
  4459. *** Error 56: String to large or not terminated.
  4460.  
  4461. This error will be given if a string is not terminated, if a string in a
  4462. DC.B cause the total byte length for that DC.B to by more than 128 bytes or
  4463. if a ASCII number is more that 4 letters. For example:
  4464.  
  4465.     MOVE.L    #'TESTING',D0
  4466.     DC.B    'TEST
  4467.  
  4468.  
  4469. *** Error 57: Redefined symbol.
  4470.  
  4471. The symbol in the label field on this line has already been defined
  4472. elsewhere.
  4473.  
  4474.  
  4475. *** Error 58: Undefined symbol ->
  4476.  
  4477. However, this symbol (after the arrow ->) has not been defined anywhere.
  4478.  
  4479.  
  4480. *** Error 59: Unknown section type requested.
  4481.  
  4482. You have specified a section type that is not valid. Look under the SECTION
  4483. directive for a list of valid section types.
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.  
  4490. *** Error 60: Illegal size specification for this instruction.
  4491.  
  4492. For example:
  4493.  
  4494.     LEA.B    Start,A0
  4495.  
  4496.  
  4497. *** Error 61: 16-bit displacement value out of range.
  4498.  
  4499. An address register displacement is out of range or a PC-relative address
  4500. is more than 32k away. For example:
  4501.  
  4502.     MOVE.L    100000(A0),D0
  4503.  
  4504.  
  4505. *** Error 62: Negative value not allowed here.
  4506.  
  4507. In some places, negative values just can't exist. For example:
  4508.  
  4509.     DS.B    -1    ; negative storage length???
  4510.  
  4511.  
  4512. *** Error 63: Illegal symbol character.
  4513.  
  4514. If you try to define a symbol that includes a character that is not one of
  4515. the following,  0 - 9, A - Z, a - z, (.), (_), you will get this error.
  4516. For example:
  4517.  
  4518. what?    EQU    4
  4519.  
  4520.  
  4521. *** Error 64: Invalid type for XREF requested.
  4522.  
  4523. You have used a type specifier with XREF that is not .R, .A or .L
  4524.  
  4525.  
  4526. *** Error 65: Local and temporary symbols can't be exported.
  4527.  
  4528. Don't try do XDEF locals and temporaries, if won't work.
  4529.  
  4530.  
  4531. *** Error 66: Short bsr to next instruction.
  4532.  
  4533. The only example:
  4534.  
  4535.     BSR.S    next
  4536. next    ...
  4537.  
  4538.  
  4539. *** Error 67: Address is NOT even.
  4540.  
  4541. This error will only be reported if OPT E+ is used and the assembler finds
  4542. and odd address in use with a word or longword access. For example:
  4543.  
  4544.     MOVE.W    $1,D0    ; error
  4545.     MOVE.B    $1,D0    ; ok
  4546.  
  4547.  
  4548. *** Error 68: Positive or odd link offset.
  4549.  
  4550. For example:
  4551.  
  4552.     LINK    #33,A5
  4553.  
  4554.  
  4555.  
  4556. *** Error 69: Expression must be absolute.
  4557.  
  4558. You have used a relative expression, e.g something that needs relocation,
  4559. where the assembler must have an absolute value. For example:
  4560.  
  4561. empty    DS.L    empty    ; the assembler must know the size of the area.
  4562.  
  4563.  
  4564. *** Error 70: Linker format error.
  4565.  
  4566. This error only occurs in executable code. You have made an illegal
  4567. reference between two different sections. For example:
  4568.  
  4569.     SECTION    ONE
  4570.     BRA    START
  4571.     SECTION    TWO
  4572. START    ...
  4573.  
  4574. Since you don't know where the sections are loaded this is not allowed.
  4575.  
  4576.  
  4577. *** Error 71: Expression must be relative.
  4578.  
  4579. You have used a absolute value where the assembler expects a relative one.
  4580. For example:
  4581.  
  4582.     BRA    $10
  4583.  
  4584.  
  4585. *** Error 72: Instruction needs relocation.
  4586.  
  4587. If OPT P+ is in use and the assembler finds an instruction/directive that
  4588. needs relocation, this error will be given.
  4589. *** Error 73: Relative expressions not allowed.
  4590.  
  4591. You will get this error if you use an relative expression in a place where
  4592. relocation is impossible. For example:
  4593.  
  4594. tt    DC.W    tt
  4595.  
  4596.  
  4597. *** Error 74: '#' probably missing.
  4598.  
  4599. This error will only be given if OPT I+ is in use and an absolute long
  4600. source operand is given where it is not normally supposed to be.
  4601. For example:
  4602.  
  4603.     AND.B    $20,D0
  4604.  
  4605.  
  4606. *** Error 75: Illegal octal character.
  4607.  
  4608. If a character outside 0 - 7 is found in an octal number you will get this
  4609. error. For example:
  4610.  
  4611.     MOVE.L    #@1238,D0
  4612.  
  4613.  
  4614. *** Error 76: Number out of range for 32-bit integer.
  4615.  
  4616. For example:    MOVE.L    #17985783498423964397543,D0
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622. *** Error 77: Invalid monadic operator.
  4623.  
  4624. The monadic operators allowed are +, - and ~. Any attempt to use any other
  4625. operator as a monadic one will result in this error. For example:
  4626.  
  4627.     MOVE.L    #/10,D0
  4628.  
  4629.  
  4630. *** Error 78: Illegal operation with these symbol-types.
  4631.  
  4632. Take a look at section 3.6.2 for detailed description of what is wrong if
  4633. you get this error.
  4634.  
  4635.  
  4636. *** Error 79: Local labels not allowed here.
  4637.  
  4638. Local labels are only allowed under special conditions, see section 3.5.2,
  4639. and if you use them anywhere else you will get this error. For example:
  4640.  
  4641. 4$    EQU    10    ; oh no
  4642.  
  4643.  
  4644. ** Warning 01: 68010 and upwards instruction, Converted to MOVE SR,.
  4645.  
  4646. If you try MOVE CCR, you will get this warning.
  4647.  
  4648.  
  4649. ** Warning 02: Garbage found after instruction.
  4650.  
  4651. For example:    DS.B    10,20 ; ,20 is ignored but the syntax is wrong.
  4652.  
  4653. ** Warning 03: Directive has no effect in reloc-files.
  4654.  
  4655. For example, if you use an ORG directive in an executable or linkable file
  4656. you will get this warning, but the directive is ignored by the assembler.
  4657.  
  4658.  
  4659. ** Warning 04: BLOAD to outside allocated section.
  4660.  
  4661. If you get this error when producing executable or linkable code you should
  4662. not execute the BLOADs since the load address is outside the allocated
  4663. space and loading binary data into memory owned by something else than
  4664. MCAsm is generally not a very good idea, the system will most likely crash.
  4665. If you are writing absolute code you may want to load something into memory
  4666. not related to the actual code, say you have your code at $40000-$50000 and
  4667. want to load some graphics into memory at $60000, in this case you can
  4668. ignore the warning (if you have allocated the memory at $60000, else...).
  4669.  
  4670.  
  4671. ** Warning 05: BSAVE from outside allocated section.
  4672.  
  4673. This is the same as for BLOAD except that the system can't crash if you
  4674. just save something. The warning simply indicates the you may be saving the
  4675. wrong data.
  4676.  
  4677.  
  4678. ** Warning 06: Directive has no effect in absolute files.
  4679.  
  4680. For example, a SECTION directive has no effect in absolute code and is
  4681. ignored, but this warning is given.
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687.  
  4688. ** Warning 07: Output file-name has already been defined.
  4689.  
  4690. If you give an output file-name when selecting FILE as output and then try
  4691. to redefine the file-name with OUTPUT you will get this warning. The OUTPUT
  4692. directive is ignored in this case.
  4693.  
  4694.  
  4695. ** Warning 08: Directive has no effect if output isn't a file.
  4696.  
  4697. For example, if you use OUTPUT and the output is memory.
  4698.  
  4699.  
  4700. ** Warning 09: Directive has no effect if output isn't a linkable file.
  4701.  
  4702. For example, if you use XREF in and don't produce linkable file.
  4703.  
  4704.  
  4705. ** Warning 10: 68020 and upwards branch size, '.W' should be used.
  4706.  
  4707. If you used .L as branch size this warning will be given and the size
  4708. converted to .W.
  4709.  
  4710. ** Warning 11: Short branch to next instruction, Converted to a NOP.
  4711.  
  4712. For example:
  4713.  
  4714.     BRA.S    next
  4715. next    ...
  4716.  
  4717.  
  4718. The following warnings are optimisation warnings and only occur if the
  4719. relevant optimisation and warning is enabled, and of course - the assembler
  4720. have found something to optimise.
  4721.  
  4722. ** Warning 12: Branch made short.
  4723.  
  4724. Backwards un-size branch made short.
  4725.  
  4726.  
  4727. ** Warning 13: Offset removed.
  4728.  
  4729. The displacement d is zero, d(An), so it is removed and the address
  4730. converted to (An).
  4731.  
  4732.  
  4733. ** Warning 14: Absolute long made absolute short.
  4734.  
  4735. An absolute long address in range for absolute short was made short.
  4736.  
  4737.  
  4738. ** Warning 15: MOVE.L made to MOVEQ. 
  4739.  
  4740. A MOVE.L #d,Dn had a d in range for MOVEQ. -129 < d < 128.
  4741.  
  4742.  
  4743. ** Warning 16: Quick form used.
  4744.  
  4745. An ADD/SUB #d,<ea> had a d in range for the quick form. 0 < d < 9.
  4746.  
  4747.  
  4748. ** Warning 17: Branch can be made short.
  4749.  
  4750. This warning will be given on all branches that can be made short.
  4751.  
  4752.  
  4753.  
  4754. ** Warning 18: Absolute long made PC-relative.
  4755.  
  4756. An absolute long backward address were in range for PC-relative addressing.
  4757.  
  4758.  
  4759. ** Warning 19: Absolute long can be made PC-relative.
  4760.  
  4761. This warning will be given on all absolute long addresses that are in range
  4762. for PC-relative addressing.
  4763.  
  4764.  
  4765.  
  4766.  
  4767.  
  4768.  
  4769.  
  4770.  
  4771.  
  4772.  
  4773.  
  4774.  
  4775.  
  4776.  
  4777.  
  4778.  
  4779.  
  4780.  
  4781.  
  4782.  
  4783.  
  4784.  
  4785.  
  4786.  
  4787.  
  4788.  
  4789.  
  4790.  
  4791.  
  4792.  
  4793.  
  4794.  
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.